A level above Akismet – Prevent comment spam in wordpress

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!

Related posts:

  1. Moving from blogger to wordpress. How I did it and some pitfalls to avoid.
  2. WordPress for iPhone: Maintain Your Blog On-the-Go
  3. WordPress Review Plugins: wpReviewSite vs wpReviewEngine + Discount Codes
  4. 4 easy steps to set up your self hosted wordpress blog
  5. What if you are not able to access plugins or tools menu in wordpress?

Blogging, wordpress