In the best Tom Woodward style1, this post is more a reference for me than most anyone else. Besides so many people are freaked out by the WordPress editor, who’s really gonna tweak a theme file?

Me.

Okay, I have a really old site that was part of the Networked Narratives fleet of sites (it’s a WordPress multisite), a fun reference on Animated GIFs, the NetNarr GIF Reader (hey that SPLOTpoint theme still rocks).

For some odd reason, it has become a target for old school blog comment spammers, mainly pipe fitting manufactures from Iraq. I kid you not. Weirdly, they target both posts and also individual items in the media library (did you even know these have comment ability)? I was happily ignoring them, it’s been maybe 15 total, but HEY KID SPAMMERS GET OFF OF MY BLOG, YOU TRYIING TO RUIN IT? (Almost no one will get that reference, it was a local TV commercial in Baltimore, that my elementry schoolpal Gordon Polokoff’s dad did the audio for).

I can turn off comment capability, but that only affects new posts. To turn off for old posts I could slap in some plugin, but it’s easy enough o use the bulk post selector, and use quick edit options to turn off comments (splained by WPBeginner if you need help). Done.

But what about the media attachments?

I found the answer in How to Disable Comments for Media Attachments in WordPress (Green Geeks Webhosting)… yes, I could have reached for the Disable Comments plugin (it works well, have used it before). But why slap more plugins on the heap, when you can add it via the functions.php file in the theme?

This worked perfectly:

I lived dangerously, and directly edited the theme on the live site (breaking the first time because the web site code I copied had curly single quotes), I might just toss this into the SPLOTpoint theme itself.

Small tools and hand coded fixes make me happy.

1Hi Tom, this footnote is made for you.


Featured Image: Mine, 100% human generated (well a camera was used)

Beautiful Simple Singing Toolbox
Beautiful Simple Singing Toolbox flickr photo by cogdogblog shared under a Creative Commons (BY) license

If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
Become a patron at Patreon!
Profile Picture for cogdog
An early 90s builder of the web and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person.

Comments

  1. Ha! I love it . . . but I also don’t use Gutenberg so your audience may be limited.

    Crazy to realize after 600 years of using WP that you can comment on media attachments. I never realized that.

    It does feel like a number of my WP sites are getting slammed lately. I’m seeing hundreds of hack attempts. No media spam yet, but I’ll keep my eyes open.

Leave a Reply

Your email address will not be published. Required fields are marked *