Reduce WordPress Spam By Creating Fake Comment Forms For Spam Bots
Tony Williams | Feb 16, 2007 | View Comments
Top Tip: Click here to run a free scan for common PC errors
- Now, in your WordPress comments.php file look for the following lines (should be at the end):
</form>
<?php endif; // If registration required and not logged in ?>
Directly inbetween these lines add the following:
<?php /* ===============================fake =======================================*/?>
<div style="display:none;">
<form action="<?php echo get_option('siteurl'); ?>/fakecommentform.php" method="post" id="commentform">
<input type="text" name="author" id="author" value="" size="22" tabindex="1" />
<input type="text" name="email" id="email" value="" size="22" tabindex="2" />
<input type="text" name="url" id="url" value="" size="22" tabindex="3" />
<textarea name="comment" cols="20%" rows="10" tabindex="4">1</textarea>
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
<input type="hidden" name="comment_post_ID" value="<?php rand(2000,5000); ?>" />
</form>
</div>
<div style="display:none;">
<form action="<?php echo get_option('siteurl'); ?>/fakecommentform.php" method="post" id="commentform">
<input type="text" name="author" id="author" value="" size="22" tabindex="1" />
<input type="text" name="email" id="email" value="" size="22" tabindex="2" />
<input type="text" name="url" id="url" value="" size="22" tabindex="3" />
<textarea name="comment" cols="20%" rows="10" tabindex="4">1</textarea>
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
<input type="hidden" name="comment_post_ID" value="<?php rand(2000,5000); ?>" />
</form>
</div>
<?php /* ===============================fake end =======================================*/?>
I’ve added in two fake forms which should be enough to keep spam bots busy before they reach the real comment form.
Add fakecommentform.php To Your Server
What we are doing is sending spam bots to a fake comments form. We need to actually add this file to our servers otherwise a lot of 404s will be generated, which isn’t a good thing for your server. I’ve attached this file (right-click and select save) which needs to be uploaded to the home directory of your blog. I’ve left a friendly message for the spam bots – feel free to change the message. It’s best to keep this file as small as possible so that the spam bots don’t eat away your bandwidth.
I hope that you found this tip useful. Please share it with all of your blogging buddies as I bet they have a spam problem as well. Update: This tip has been submitted to Digg – if you want to digg it or read the comments left on Digg click here
Continue Reading This Post:12
Read Related Posts
Filed Under: Using The Internet
About the Author: Want to get more out of your PC, the internet or your mp3 player? Onetipaday.com is here to provide clear simple tips and guides to help you achieve just that. Each tip will be easy to implement and will take no more than 5 minutes to read and implement. What will you learn today?
- indiatorrents
- Mario Salcedo
- maibufas
- Dave
- Tony Williams
- Sarbjit Singh
- Tony Williams
- Fake ID Dude
- Yuki
- spanish golf

