If you read my rejuvenating your blog post I wrote a couple days ago then you know how much spam can be sitting in the pending status of your comment section after taking a hiatus from a blog.
These spam comments can reach into the thousands and its time consuming to go through them all and delete by hand.
So today I am going to show you one quick simple method to delete all the comments currently in your pending section of wordpress comments!
Before I did this my database was upwards of 100mb which is very hard to keep track of if I ever need to move servers or anything like that. A large % of that mb was because of all these spam comments I had waiting in the moderation que.
Its vital for me to get rid of these so my database will work quicker, backup easier and overall be more efficient!
Step by step how to do it!
1. Open up your cpanel.
2. Open up MYSQL section.
3. Open PHPMyAdmin
3. Find your database and back it up. Here is a video tutorial on how to backup your database through PHPMYADMIN. I will assume you can figure it out by following this tutorial but if you can’t just comment below or email me for further help and directions.
Video Tutorial – Backing Up Your Database
4. Now that your database is backed up, return to the main PHPMyAdmin page and open up your database.
5. From here select the wp_comments table.
6. Once in the table click the SQL button at the top of the screen.
7. You will be presented with a box and a “Go” button in the bottom right. Inside this box enter the code below that is green. Make sure to enter it into your SQL box exactly as shown so nothing gets messed up.
DELETE FROM wp_comments WHERE comment_approved = 0
8. Make sure to enter it exactly as its shown above, this will select and delete all the pending comments in your que. Simply click the “Go” button to make it happen, after you do it will return results saying xxx number of comments deleted. (SUCCESS).
All you have left to do now is log into your wp-admin panel and see how clean and pretty it looks! My suggestion is to install some GOOD comment blocking plugins so you won’t have this problem again!
If you found this useful return the favor by commenting below and by joining my newsletter like tons of others. Enjoy your spam free day!
Filed under: Personal Posts
Like this post? Subscribe to my RSS feed and get loads more!
Haha Shannon, I logged into one of my dormant blogs a couple days ago and saw ~3000 spam comments with Akismet somehow turned off. I was on the verge of just exporing the posts, creating a new blog, and importing the posts back in. Thanks for this easy fix. I know 3000 isn’t that much considering WordPress let’s you delete something like 20 a time, but hey, that’s still over 100 deletes, so this guide is awesome stuff.
Good deal Shannon, I remember encountering this problem on an old blog that I didn’t have akismet, and there was ALOT of pending comments, around 4,000, I didn’t know any better, and at the time I just did it the old fashioned way… I set it up to view 200 comments on one page… and deleted 200 at time! So much more work compared to what you’ve shown here, hehe.
Shannon, WordPress has a button that says ‘Empty Spam’ – is it not possible to move all pending comments to the spam section and then clear them from there?
Darren
You can. But how will u move those thousands of comments to the spam section? The Internet connection is to slow.
Thanks for the guide Shannon, should make it a bit easier for me to deal with the backlog on some of my sites. If only the spammers would leave a relevant comment then we could all benefit?
I am apreciating it very much.I have never read such a lovely article and I am coming back tomorrow to continue reading.
This article is informative and wonderful ,I will read more.
I am interest in reading this article.
The article written by you very good, I like it very much. I will keep your new article.
Even while using the akismet(or a similar) plugin to block spam you will run into the same problem if you ignore your site for too long as most plugins will just mark those comments as spam and not delete them. So you will ultimately run into page timeouts while trying to delete them all. If you slightly alter the query you posted you can delete just the comments marked as spam by these plugins.
DELETE FROM wp_comments WHERE comment_approved = ‘spam’