I’m Getting a Ton of Comment Spam on My WordPress Blog! What Can I Do to Stop It?

With the popularity and proliferation of blogs, so-called “comment spam” – that is people using the blog’s comment area to post the bloggie equivalent of spam – has raised its ugly head.

There are two types of comment spam – the first is manual spam, where the spammer actually goes to your blog, and clicks on the “post a comment” link, and types (or more likely pastes) a message, and submits it. That sort of spam is annoying, but doesn’t scale for the spammer, and so is not much of a problem.

But many clever spammers have managed to automate the posting of comment spam, and they are able to do this because most standard blogging packages, including WordPress, have a default file name for their comment submission template.

WordPress’ default comment post file is “wp-comments-post.php”.

What this means is that the spammer’s scripts are crawling sites, looking for “wp-comment-post.php”, and t hen they find it, bingo, the script posts their spam.

Fortunately, the WordPress design also makes it very easy to defeat this sort of spam.

You just have to rename the file so that the spammer’s scripts don’t find it.

The process is simple, and requires two steps.

First, copy your wp-comment-post.php file to a file with some other name. This will be the new name for the comment posting file. I use something like “no-spam-here.php”.

If you are on a Unix style system, just do:

cp wp-comment-post.php no-spam-here.php

Ok, now find the file called “wp-comments.php”.

Open this file with your favourite editor, and find the line which says:

You should find it at approximately line number 53.

Ok, see where that line says “wp-comments-post.php”? Change that to your new file name, save it and exit the editor.

That’s it! You’re done!

Once you are sure that you have it the way you want, delete the original wp-comment-post.php, or rename it to something like wp-comment-post-original.php for archival purposes.