Posted in February 2005

Anti-Spam Comment Check Box

In her comment, Jen asked about the anti-spam check box feature I use.

The hack was originally written by Otsukare (who is in charge of WordPress Japan site) and fully explained in Japanese here:
WordPress Japan Wiki: Anti Spam

Well, I translated it so here you go!

In wp-comments.php on line 78, add the following check box (right before the “submit” button).

<input type="checkbox" name="spam_guard_check" value="1" /> Please Check

In wp-comments-post.php on line 41, find this :

if ( '' == $comment )
die(_LANG_WPCP_ERR_TYPE);

And add this right after it:

$spam_guard_check = $_POST["spam_guard_check"];
if(!$spam_guard_check){
die("Please check here before posting your comment.");
}

(You can modify the messages if you want)
It’s been working wonderfully and I haven’t got any spam comment for a couple of weeks (as of 2/11/05, I’ve got only one spam comment so far. 1 in 10 days- not bad, right?).
It’ll only take 3 minutes to set it up. Well worth a try!

update: :( I am starting to get some spams even with this hack. I still believe it’s better to have than not to, though..

Another Update: I upgraded this blog to WP1.5, and got rid of this check box hack. Instead, I am trying out Bad Behavior plugin… Thanks for your comment, Niklas!!

Tagged , , ,
Follow

Get every new post delivered to your Inbox.

Join 3,302 other followers