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 5 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.
  • The comment is very similar (over 75% similar) to a previously posted comment. This prevents spammers from copy and pasting a previously posted “real” comment and simply changing some links

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).

Upgrade:
If you are upgrading from a previous version (0.5 and older), please install the upgrade version. The plugin’s file structure was reorganized to support WordPress’ new auto update feature.

Installation:

  1. Download and unzip the plugin.
  2. Upload the entire “tantan-spam-filter” 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. Configure your spam and reCAPTCHA settings by going into “Comments” -> “Spam Filter”
  5. You’re done!

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. Pingback: Tam Tam’s span filter cuts out crazy amounts of spam comments
  2. Pingback: WordPress Plugins Database » Plugin Details » TanTanNoodles Simple Spam Filter
  3. # 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.

  4. Pingback: Spam Combat, reduce and manage spam | Cinila's Personal Playground
  5. Pingback: Installed Simple Spam Filter | Raam Dev’s Weblog
  6. # 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

  7. # bostanc�± May 07, 2008

    thank you very much.

  8. # Jan May 11, 2008

    Recaptche is the best IMHO

  9. Pingback: WordPress 防垃圾留言插件:Simple Spam Filter at 第七封印
  10. Pingback: Tan Tan Noodles Simple Spam Filter for Wordpress | Evil Genius Chronicles
  11. # Naseer Ahmad Mughal Jun 10, 2008

    Hi everybody,

    I have just download this plugin. But how can i activate this on my blog. Please guide me in this regards,

    Thanks and regards,
    Naseer Ahmad

  12. # Joe Tan Jul 01, 2008

    @Naseer, just active the plugin and that should be it. Go into the settings screen for additional options (Comments -> Spam Filter).

  13. # Ana Hernandez, CEO Netrageouz.net Jul 08, 2008

    great plug in and over 2,00 downloads! Thanks Joe. I’m always looking for ways to facilitate networking with like-minded individuals. I especially appreciate unique tools that help me harness the power of web 2.0 and social bookmarking sites so I can make good use of my time. There’s nothing worse than spending countless hours online to build your online presence, while losing valuable time that you could be spending with your friends and family. Luckily, I’ve found tons of useful tools to meet like-minded individuals and network super efficiently. In this age of user generated content driving up a website’s ranking, content is king and getting that content in front of the right people is the name of the game! Keep up the great blog.

    Ana Hernandez, CEO Netrageouz.net
    http://www.netrageouz.net/toolbox.htm

  14. Pingback: Weblog von Hartmut und Marcella » Kampf dem Spam » Spam, Akismet, Kommentar, Captcha, Wörter, Plugins, Public-, Private-Key
  15. # FutureBoy Jul 18, 2008

    Thanks a lot. Great plugin!

  16. # Susan Jul 30, 2008

    Wow, I like this feature a whole lot more. Much better than leaving it up to only Askimet. Great job!

  17. # Flavien Aug 03, 2008

    Hello !

    I think it’s a very good plugin, however, like Dalton, it doesn’t work in my blog : the page which says that the comment is a spam displays but there is not re-Captcha… I work with WP 2.6 .

    Thank you and excuse me for the mistakes (I’m French).

    Flavien

  18. # Life Insurance For Seniors Aug 06, 2008

    Ah. A wonderful plugin to save us time and effort. Time is money, and this saves me TIME!

  19. Pingback: Investigations of a Dog » New spam filter
  20. Pingback: Contingency by Design » Blog Archive » You drove me to do this . . . .

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!