How-To Geek

WordPress Plugin – The Geek’s Spam Filter

As this site has gained popularity, the time required to keep the site running has also grown. For instance, even though Akismet blocks virtually all of the spam comments, I still have to manually filter through hundreds of spam comments per day to see if any valid comments were blocked.

And so, the Geek’s Spam Filter was born.

This spam filter is designed to completely block and delete most, but not all spam. It runs before Akismet does, so it saves processing time on your site, as well as a lot of your time.

Feature List

  • Deletes any spam with more than 5 links. The majority of spam has a zillion links because not only do dirty rotten spammers never stop, they are also stupid.
  • Blocks any comments containing any one of a whole bunch of spam words. These are defined manually in the plugin file.
  • Runs before Akismet does, so it will work in conjunction.
  • Explains to the spammer in a very friendly way that you hate them.
  • Works fine with WordPress MU edition.

Things this plugin does not do (sadly)

  • Track down the dirty rotten spammers and beat the living daylights out of them.


HowToGeek Spam Filter version 0.3


Unzip the zip file into your wp-content/plugins directory and then activate in the WordPress panel.


0.3 Changed logic to concat the fields together to reduce processing time
Added more keywords to the list
0.2 Added URL to list of fields to check. Unsure of why I didn’t do that in the first place
  Added a number of extra keywords to the list
0.1 First version.


Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 06/8/07

Comments (8)

  1. Mr Linux

    So, can we expect the “beat the living daylights” feature somewhere in release 2.0?

  2. Tim

    I don’t see many spam on this site. I guess this thing is working!

  3. The Geek

    Yeah, there shouldn’t be any spam on this site. I also moderate comments as well just to make sure.

  4. Ryan Wagner

    I just wanted to see what words you were blocking so I downloaded the file. I don’t know why, but I couldn’t help but lauch when I read a lot of them, but most of them I have blacklisted, too. :)

  5. The Geek


    I basically just add to the list as spam changes over time… lately I’ve been getting some weird spam about desk lamps. Very odd.

  6. jeremyduffy

    I have been looking for something EXACTLY like this for MONTHS. I’ve left a message in the WordPress forums and I contacted Akismet several times. It’s SO obvious! I never want to see obvious spam!

    How do I know it’s obvious spam? Why, by keyword and number of links of course. DUH!

    Thank you thank you! I can’t wait to try it out.

  7. JeremyDuffy

    Tried it and it looks pretty good. Three suggestions (two of which I already implemented by changing your code slightly):

    1) Have it print out the actual word that made it crash out when it finds a filtered word. The bigger the badlist, the more likely that some string of characters in their comment matches.

    2) Put a break in the badlist foreach loop. After it finds a word, there’s no need to keep looking.

    3) (the one I DIDN’T do) Obviously this would require a fair bit of work to do, but having some kind of simple config panel that can be accessed through wordpress (like akismet has) where I can change the number of links to check by and add/subtract from the bad word list would be great.

  8. Bruce Eggum

    Do you have a spam prog for Drupal too?
    Thanks for a very valuable site.


More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!