RSSSubscribe to Review Of Web

A level above Akismet – Prevent comment spam in wordpress

3

Sponsored Links


stop-spam

Akismet is a proven way to prevent comment spam in wordpress powered blogs. It does a great job of sifting spam comments and redirecting them to the spam folder.

There is still a problem with this. Though spam get redirected to the appropriate folder but it unnecessarily clogs our MYSQL database. Moreover there is always a chance that among the hundreds of spam comments there is one good comment and unknowingly you might end up deleting that good comment as well, while cleaning up the folder.

I did some analysis on my spam comments (wordpress dashboard > comments > spam) and found that they mostly originate from 2-3 common IP’s. If I can get some way to automatically delete comments coming through those IP’s my problem would be partially solved(other spammers would still be there…grrr).

Here is a simple SQL script I wrote to do this:

DELETE FROM `wp_comments`
where `comment_author_IP` = ’66.159.18.9′ OR
`comment_author_IP` = ’84.19.188.218′;

Keep on adding the spammers IP’s that you see from your wordpress dashboard.

Now you can set up a  cron job that runs every night or every week or every fortnight (depending on your requrements). All your spam comments would get deleted automatically at a given interval.

Gozar!

Digg, Stumble, Twit or share this post by clicking on any of the buttons below:
  • Digg
  • del.icio.us
  • StumbleUpon
  • Sphinn
  • Yahoo! Buzz
  • Technorati
  • TwitThis
  • Facebook
  • MySpace
  • Google Bookmarks

Welcome to Review Of Web. I recommend you to subscribe via RSS Feed. You can also subscribe by email and have new articles sent directly to your inbox. It's absolutely free!

Related posts:

  1. WordPress for iPhone: Maintain Your Blog On-the-Go
  2. Thesis Theme for WordPress – Design a WP Theme without coding knowledge

Comments

3 Responses to “A level above Akismet – Prevent comment spam in wordpress”
  1. Kurt Avish says:

    Simple..but genius :-) Nice post. Spammers mostly use the same ip as many of them uses anonymous posting service to send spam.

  2. Mr. I says:

    Nice idea to block spam without any false positives and extra plugins. I love the fact that its very light!

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!