Simple Spam Filter for WordPress

65 Comments

On this little slice of the web, this blog might get thousands of comments each week, 99.9% of which are spam comments… a bit ridiculous if you ask me. The Akismet anti-spam plugin does a great job blocking all these spam comments, and I’m grateful for that. But because of the shear volume of spam, it becomes nearly impossible to check for any real comments might’ve gotten incorrectly labeled as spam. I’m usually happy if I get 2 or 3 real comments in a week, so to me (and I think most bloggers out there), every comment is important. And really, what is a blog if no one comments?

One thing I noticed while looking at the current generation of comment spams is that they tend to be immediately identifiable with some sort of pattern (see first screenshot). So I wrote the Simple Spam Filter to do a couple simple tests and immediately block and reject obvious spam comments.

If a comment gets rejected, then an error screen will be shown with an explanation of why the comment was rejected. An optional captcha (provided by reCAPTCHA) can also be configured to display, which allows people to confirm that their comment is indeed legitimate. The plugin also works in conjunction with Akismet and will display a captcha if Akismet flags a comment as spam (see second screenshot). In all cases, the captcha is displayed only if a comment doesn’t pass the obvious spam rules or if Akismet thinks a comment is spam. Comments that don’t pass the captcha are immediately rejected and discarded.

Screenshots
spam-screenshot.gif captcha-demo.jpg TanTanNoodles Spam Filter

From my own testing, the following 4 patterns will catch at least 90%+ of all comment spam. This will probably evolve over time (check back for updates!), but for now it works pretty well. A comment will be rejected if it matches any of the following patterns:

  • Contains 5 or more links to external sites
  • Contains nothing but links
  • Contains [url=http://www.example.com]example[/url] style links (my blog does not support bbcode style links)
  • Contains a word that matches a short list of common spam words (for example, viagra or cialis). See the plugin’s source for the full list.

As I mentioned above, this plugin isn’t meant to replace any of the existing spam plugins out there, but rather to work in conjunction with them. It does a simple “prefilter” to weed out the most obvious comment spams and then gives people who’s comments get flagged as spam an opportunity to confirm with a captcha that their comments are indeed legitimate.

I realize that this plugin is not fool proof by any means, since spam will continue to evolve over time; but now at least you don’t have to deal with comments that are obviously spam and hopefully spend a little less time looking for real comments incorrectly labeled as spam.

Author: Joe Tan (joetan54@gmail.com)
License: GPL
Features:

  • A simple pre-filter to weed out the most obvious comment spam (about 90% of all spam).
  • Legitimate comments that get blocked (either by this plugin or by Akismet) can be presented with a captcha to confirm that the comment is legitimate. Comments that don’t pass the captcha will be immediately discarded.
  • Helps you identify potential spam words (you can use this to tweak the plugin’s filters).

Installation:

  1. Download and unzip the plugin.
  2. Upload the entire “tantan” directory to the WordPress wp-content/plugins directory.
  3. Login to your WordPress admin, click “Plugins”, and then activate the “TanTanNoodles Simple Spam Filter” plugin.
  4. You’re done!
  5. Bonus: Enable the”TanTanNoodles Version Checker” plugin to automatically get notified of when updates to this plugin are available.

Download the plugin

Support:
If you are having problems setting up or customizing this plugin, please visit the support group for help. Someone may have already posted a solution to your problem!

More Documentation: Modification History, Known Issues and Bugs

Bug Reports:
If you find a bug or have a feature request for this plugin, please post them to this Google Project page.

Developers:
Browse this plugin's source code at the Subversion repository.

Want more WordPress goodness? Check out some of my other plugins and scripts >

65 comments

  1. # Rodrigo Mar 07, 2008

    I installed this plugin and it worked very nice. Congratulations.

  2. # freetreasure Mar 11, 2008

    lol..thanks for the plugin

    but you still need human to control it….sometimes spammar are too clever!

  3. # Arcade game freak Mar 12, 2008

    Hi there, I just started experimenting with wordpress. Thanks for this cool plugin. I’ll check it out! :)

  4. # Sevgi Mar 21, 2008

    I installed this plugin and it worked very nice. Congratulations Thank you

  5. # Max Kima Mar 27, 2008

    Hi! I’ve been using Akismet for a rather long period of time. Besides, I use a spam filter to cut messages at the moment of publishing. But I’m not sure it is the best solution, i’ll try your plugin.

  6. # Drew Mar 30, 2008

    Just downloaded the plugin, thanks so much!

  7. Pingback: Tam Tam’s span filter cuts out crazy amounts of spam comments
  8. Pingback: WordPress Plugins Database » Plugin Details » TanTanNoodles Simple Spam Filter
  9. # tank Apr 10, 2008

    That’s awesome. Just what I was looking for. Thanks!

  10. # Superhead Apr 11, 2008

    Nice one. Wouldn’t it be great if spammers saw their message get flagged as spam and left your site forever. Love your work.

  11. # Msn Nickleri Apr 11, 2008

    Great plugin. Thank you a lot.

  12. Pingback: Spam Combat, reduce and manage spam | Cinila's Personal Playground
  13. # muhabbet Apr 17, 2008

    well thanks for the info.. i wil consider to use this plugin.. to prevent spams.. thx once again

  14. # Anti Spam Apr 18, 2008

    Great plugin. This will be very useful!

  15. Pingback: Installed Simple Spam Filter | Raam Dev’s Weblog
  16. # Dalton Apr 29, 2008

    This plugin looks very promising but the re-captcha function doesn’t work for me. Even though it is set up with my key, the filter just tells me the comment has been blocked (no option to enter captcha). I am using Wordpress 2.5. Any ideas?

    Thanks,
    Dalton

  17. # estetik May 01, 2008

    This is a very useful plugin. I recommend it.

  18. # bostanc�± May 07, 2008

    thank you very much.

  19. # prefabrik ofis May 10, 2008

    Thank you for very helpful blog.

  20. # Jan May 11, 2008

    Recaptche is the best IMHO

View all 65 comments

Leave a comment

Support:
If you are having problems setting up or customizing this plugin, please visit the support group for help. Someone may have already posted a solution to your problem!