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";
DELETE FROM wp_comments WHERE comment_approved = "0";
DELETE FROM wp_comments WHERE comment_type = "spam";
And you’re done.