Ending Comment Spam

Since the beginning of winter break, I have been deluged by comment spam attempts. Most of them involved "tramadol," a painkiller, or "texas hold-em poker," both of which are included on the list of words that cause comments to be moderated (a list which borrows heavily from the "Spam Words" list on the Wordpress Wiki). However, it was still annoying to both delete all of the notification emails and the comments from the moderation queue.

I could have attempted to block the IP addresses being used in my .htaccess file, but that would only be a temporary solution, since the spammers switched IP addresses about once every 24 hours. I also could have switched comments off, but that would be too radical. Hence, I have changed wp-comments-post.php (which is, of course, the file containing the code that allows you to post comments on WordPress blogs, so that it is impossible to post a comment without previewing it first. In the comment preview code, I added a new form value to the comment preview:
<input type="hidden" name="previewed" value="1" />
Right below the comment that states, "If we've made it this far, let's post," I added a new IF statement:
if(!$_POST["previewed"]){
die( __('In an attempt to reduce comment spam, you must preview your comment before posting it.') );
}

Of course, nobody will ever see that message (except inquisitive comment spammers), since I also commented out the Post button from wp-comments.php (which controls the comment form seen below).

Comments

At 11:08 on January 3, 2005, Margaret wrote:

Excellent. I've been getting the same ones. I'll use this.

At 9:17 on February 5, 2005, polka dot zebra ยป Let&#8217;s end the comment spam wrote:

comment spam Filed under: technology — Margaret @ 9:16 pm


    Inspired by Martey (as well, of course, by all the comment spam I&#8217;ve been getting lately), I&#8217;ve done somet [...]

At 9:43 on May 30, 2005, This is Martey Dodoo wrote:

Commenting on Comments

I replaced wp-comments-post.php, which forced previews of comments in an attempt to get rid of comment spam with two Wordpress plugins: Brian&#8217;s Threaded Comments and Live Preview for Comments. If I see a uptick in spam comments (I have not recei...

At 4:30 on September 29, 2007, Martey wrote:

Ending comments on this post because it is no longer in effect, and this post gets the most spam comments of the 700 posts currently on this website.