Comment spam plugin

I’ve wrote a wordpress plugin that hopefully eliminates comment spam on our site as well as slows down the stupid comment spammers. The plugin is called SpamBam and it is released as freeware under the GPL license. The only drawback is that javascript is required to post a comment.


The new version of SpamBam is out 1.2, it now allows WordPress comment spam protection to work alongside SpamBam.


To install the plugin simply create a folder called “spambam” in the “wp-content/plugins/” directory and place the spambam.php file in that folder. So your full path to the plugin should be “wp-content/plugins/spambam/spambam.php”. Once you have copied spambam to the folder, you need to enable it in the plugins section of the wordpress admin.

  1. Download the current release
  2. Unzip and copy the whole spambam folder to your plugins directory.
  3. Enable SpamBam in the WP Admin >> Plugins section.
  4. Done!

Optional configuration

SpamBam requires no configuration but if you wish to alter the delay option, by default SpamBam has a 30 second delay if it detects a comment spammer, you can change this in the spambam.php file to any value desired. The constant variable SPAMBAM_SPAMMER_DELAY is used to define the seconds delay. Change the following line (if required).


31 Responses to “SpamBam!”

  1. Weblog Tools Collection » Blog Archive » WordPress Plugin Releases for 2/12 writes:

    […] SpamBam prevents comment spam and fights against comment spammers by delaying their attempts. […]

  2. Módulos para Wordpress para el 14 de febrero - Carrero Bitácora de los Hermanos Carrero, David Carrero Fernández-Baillo y Jaime Carrero Fernández-Baillo. Todo sobre Internet, Tecnología, Tendendias, Dominios, Bitácoras, Diseño y Programación, … writes:

    […] SpamBan previene el spam y ataques a los comentarios, poniendo un delay a cada comentario. […]

  3. MikeS writes:


    Great plug in.

    However, there is one small problem.

    For some reason, this is overriding my comment moderation settings.

    For example, I have a setting that says if a comment has two more http links, to hold it in moderation.

    However, that is no longer working.

    Can you please let me know what you might think is occurring?

    My blog is


  4. Gareth Heyes writes:

    Hi Mike,

    Glad you like the plugin 🙂

    I shall have a look into that, my code might be overwriting the link moderation. I’ll let you know when there is an update.



  5. MikeS writes:

    Thanks Gareth

    I must tell you, this is the only thing that seems to work with the new version of WordPress.

    Everything else does not.

    Hope you get that fixed.


  6. selad writes:


    I have installed the plugin on a large WordPress-mu site and we have some problems in a few cases. Can I contact you in via email?



  7. Gareth Heyes writes:

    Hi Elad

    Yes no problem, please email any details of problems with Spambam.



  8. Mario writes:

    When I enter a comment to test it, it treats it as spam. Is that what it supposed to do? I thought it would detect bots only. Thanks.

  9. Gareth Heyes writes:

    Hi Mario javascript and cookies are required to use the script, it does work because Spambam is installed on this site and you managed to enter a comment on here.

  10. Martijn writes:

    I have a problem on my website, there seems to be a conflict with another plugin ‘fgallery’. See the link for the error:

    What can i do?

  11. Gareth Heyes writes:

    Hi Martijn

    Please try and upgrade to the latest version of Spambam.

  12. ardamis writes:

    I’ve come up with a similar, JavaScript-dependent method of defeating spam bots.

    Basically, you start by renaming wp-comments-post.php, the script that processes the comment form. Then you hide the URL of the renamed script in an external JavaScript file. When a human user performs a specific task (such as filling out the answer to a challenge question), the URL is written back into the page and the form can be submitted.

    If you don’t like challenge questions, delaying the re-writing of the URL by a few seconds should work just as well.

    The post detailing this method is at

    Good luck,

  13. Gareth Heyes writes:


    That method is very flawed because as soon as the external js file is spidered your protection fails.

  14. Petter writes:

    Nice plugin for WP
    this is what i am looking for

  15. papajoneh writes:

    I am testing this spambam plugin now by commenting.. i still don’t understand how this plugin works. clicking post now.

  16. Gillis Winderickx writes:

    I am going to check your plugin !

  17. selad writes:

    Hi, was the problem reported in the first comment resolved?

  18. Gareth Heyes writes:

    Hi selad

    Yes this problem has now been resolved

  19. Doctor writes:

    Nice plugin! Tanks

  20. evden eve writes:

    Thx for this nice Plugin…

  21. nakliyat writes:

    can you give me sql queries

  22. erer writes:

    Thx for this nice Plugin…

  23. luk writes:

    hi Gareth
    thanx for your plugin
    but i have a small issue though
    actually, it is the same problem, reported on the comment #6?, but i have both JS and cookies turned on. thats 100%, because i’ve been comenting on my blog before, and now, after a few hours it turns that i can’t do it. i’ve tried to refresh the page, but still nothing. what should i do now?

  24. Gareth Heyes writes:


    A new version is in the works, it should be released soon and it will fix your problems.


  25. luk writes:

    thanx Gareth
    also i have a small question
    on my blog i have only registered users comemnting turned on. But somehow bots are sending comments also. So, i had to turn premoderation on. But i have so many premoderated messages everyday.
    There is one small difference between a bot and a real person – bots does not have email field filled.
    Is there any way to make a plugin, that rejects any comment without email field?

  26. Gareth Heyes writes:


    You should be able to do that in your WordPress settings admin menu. The new version of spambam should hopefully eliminate your spam problem.


  27. evden eve nakliyat writes:

    Thx alot

  28. Max Kima writes:

    I used Akismet and this one! Like them both! Thanx for the site!

  29. StrikeGod writes:

    WordPress оченьхорошо защищает от спама, за что ему огромное спасибо

  30. nakliyat writes:

    here was so much potential for good work there, if you could get through to the thick-skulled business types.

  31. بلياردو writes:

    WordPress оченьхорошо защищает от спама, за что ему огромное спасибо