Top

Reduce WordPress Spam By Creating Fake Comment Forms For Spam Bots


Last month I gave tips on how to eliminate WordPress Spam forever. Today I’ve got an ever better tip for reducing comment spam on WordPress blogs, but should also work on other sites with comment forms.

My friend Billy came up with a neat mod to trick these spam bots on my site, which is increasingly coming under attack. Most comment spam comes from spam bots that try to post comments to the first comment forms they see. So, what I’ve done on this blog is create a few fake forms that are placed in front of the real comment form, and are invisible to real readers. This means that the stupid spam bots try and post spam to these forms first, and never make it through to the real forms so I never see the spam!

To add fake comment forms to your site do the following:

Create the Fake forms

  • In your WordPress comments.php file look for the following lines:
  • <?php else : ?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

  • 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 =======================================*/?>

    so that your comments.php now looks like this:
    <?php else : ?><?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 =======================================*/?>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

, , , ,

96 Responses to Reduce WordPress Spam By Creating Fake Comment Forms For Spam Bots

  1. bagkxlzny September 8, 2010 at 3:12 pm #

    allzkL stgkimbbykto, [url=http://nwjwwiguishj.com/]nwjwwiguishj[/url], [link=http://tzjfbtlrwlcf.com/]tzjfbtlrwlcf[/link], http://bbnvutwvpicl.com/

  2. name September 9, 2010 at 1:35 am #

    Numerous variations of this formula have been developed and are in use.,

  3. name September 9, 2010 at 1:33 pm #

    such a prevalent practice is that nearly all of the parties involved find it favorable in some way. Many physicians see it as necessary to provide,

  4. name September 9, 2010 at 1:58 pm #

    quantify the risks they are willing to assume and the premium they will charge to assume them. Data is analyzed to fairly accurately project the,

  5. name September 9, 2010 at 2:25 pm #

    and sports figures. However, all exposures will have particular differences, which may lead to different rates.,

  6. name September 10, 2010 at 1:32 am #

    This squat car, which is usually filled with several passengers, then slows abruptly, forcing the driver of the chosen car to collide with the ,

  7. name September 10, 2010 at 1:58 am #

    items sustain physical loss or damage from a covered cause.,

  8. izmir March 2, 2011 at 10:48 pm #

    Type your comThere is other method, simple and truly transparent for users:

    1. Put in the form a commented out hidden field:

    If variable spam1 is passed to wp-comments-post.php, get rid of spam:

    2. Put in the form a hidden field:

    If variable spam2 isn’t passed to wp-comments-post.php, get rid of spam:

    3. Check the value of the submit button. If it’s different from the value in the comment form, get rid of spam:ment here.

Leave a Reply