With traffic comes spam. This I know. But popping on my laptop this morning, I was confronted with 114 emails to my main account, all but 3 of which were comments waiting to be approved. Of those 111 comments awaiting approval, 109 of them were spam. I spent the last 3o minutes or so looking around for a real quick plug until I can sit down and install something a bit beefier.
Here are three things you can do in 10 minutes to reduce comment spam on WordPress. Now granted, there are better fixes, but it is Superbowl Sunday and I am just looking for a band aid right now.
The first thing you can do is simply to turn up flood control. The default is 10 seconds between comments. I noticed that the 109 that I got all came within about 10 minutes, so I changed the flood control to 300 seconds between comments. Go to wp-comments-post.php and make the change here:
// Simple flood-protection
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
if (!empty($lasttime)) {
$time_lastcomment= mysql2date('U', $lasttime);
$time_newcomment= mysql2date('U', $now);
if (($time_newcomment - $time_lastcomment) < 250)
die( __('Sorry, you can only post a new comment once every 250 seconds. Slow down cowboy.') );
>
The next thing to do is to update your blacklist. Similar to MT, there are lots of blacklists out there, so Google for one and paste it into the appropriate spot in your control panel.
The last thing I did was something I found on Jeff Barr’s blog. So simple and ingenious, but god damn it if it doesn’t work. For now at least. Adding a simple qualifying question to the required comment fields filters out spam and also retards. Good stuff Jeff.
At some point when I have some more time, I plan on hooking up some of the cool CAPTCHA stuff out there, which seems to be the best solution for the long term.