How Can I Stop Spammers From Commenting On Image Attachment Pages In Wordpress
by Jo Shaer, on January 29, 2014
There is nothing worse than logging into your Wordpress website and finding page after page of spam comments.
Well, actually there is! It's logging into your Wordpress website and finding page after page of spam comments when you have closed comments to posts AND pages!
If you have not set it up in a certain way, your Wordpress installation will create a new page for each image that you upload to media.
What are Attachment Pages?
For many websites, even if comments are marked as closed on all posts and pages, there is still a loophole for spammers to exploit the comments option - on these post images pages. These are called Attachment pages.
Don't create an attachment page when you upload an image on Wordpress
What you need to do is to stop these attachment pages from being created in the first place.
When you upload your image, look on the right hand side of the dashboard.
Underneath where you can choose the size and give the image a name and description, there is a link option.
You need to set the link option to none and no attachment page will be created.
For existing images, you need to redirect all the attachment pages to the parent post.
Once that has been done, it takes on the command of comments closed from the rest of your posts and pages
How to redirect attachment pages to the parent post to stop spammers from being able to comment on them
If you have Wordpress SEO by Yoast installed on your site, you can just select Permalinks from the left hand sidebar and then check the box which says Redirect attachment URLs to parent URL. If not, there are a couple of other options - another plugin or by inserting a file into your theme. My developer prefers the latter, more elegant image.php method but the Yoast option is definitely the preferable one for less techy site owners.
Give us a call on 01702 476517 to find out more about our Wordpress workshops.