Bulk Delete WordPress Comment Spam

I notice a lot of my newly built client’s wordpress sites seem to be attracting a lot of comment spam quickly, even though they might not be blogging regularly. It’s not uncommon to see hundreds or even thousands of unapproved comments listed within months of going live. One site has only been up a few weeks and already attracted nearly 8,000 spam comments.

Trying to delete or process these comments in bulk is not supported very well in current wordpress versions as you can only show a max of 999 comments on a page so it leaves you going through pages and pages of unapproved comments. Until wordpress provides a simple “Delete all unapproved comments” or similar button, here’s a quick way of processing more than 999 comments at once.

It requires hosting and database/phpMyAdmin access so it’s not for the faint hearted but it only takes a couple of minutes. Backup your database first, then run one of these SQL commands:

DELETE FROM wp_comments WHERE comment_approved = "spam";

Or

DELETE FROM wp_comments WHERE comment_approved = "0";

Or

DELETE FROM wp_comments WHERE comment_type = "spam";

And you’re done.

It might be wise to install a spam filter to avoid these comment build ups in the first place. Akismet or SI Captcha for WordPress are good.

Leon

Identifying WordPress Spam Comments

WordPress users will know that there’s a default spam plugin called Akismet included that is fairly effective for automatically identifying and dealing with spam. If you’ve got comments turned on for your blog posts or pages then you’ll occasionaly get email notification of new comments which you must either Approve, Mark as spam or Trash and links will be provided in the email for each option.

There’s a new breed of spam that escapes filters like Akismet and appears to be a bit more real than traditional spam, ie – no mention of viagra or no funny email or web addresses with foreign lettering. They look and read like a manually created comment by a real person and probably are actually created in this way. Typically they take the form of complimentary comments about your content. Here’s one I got today for example:

“I loved this post. Very informative.”

The commenter added this web address – http://articledominance.com/freereport.html which appears to be a get rich quick offer/site asking for your email address and name, possibly to spam you some more!

My basic, common sense advice when you get comment notifications from your blog is to have a quick look at the commenter’s url/website and see if it looks legit. Also see if the commenter’s text is generic or actually relates specifically to something you’ve said in your post. As another general rule of thumb, if the comment doesn’t contribute anything interesting, related or useful to the discussion on your article then I’d delete it.

Here’s a few things, specifically to do with the commenter’s website that I would delete or mark a comment as spam for:

  • Overselling something,
  • Get rich quick content,
  • Asking for signups/email addresses,
  • Advert heavy sites,
  • Sites with tons of Google adverts,
  • Completely unrelated site.

Leon.