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.
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.
3 thoughts on “Bulk Delete WordPress Comment Spam”
thanks for the usefull post. i get around 500 spam comments / day on http://www.androidfreeapp.net and it is quite annoying !
You made certain good points there. I did a search on the subject matter and found the majority of people will have the same opinion with your blog.
Hi Leon, very interesting advice (as always), I had that problem and did not immediately realise I could change the screen options. I went with Akismet and have not looked back. I helped my sister set up a small blog and we installed the free personal use Akismet and all her spam has been caught.