When comments come in for your WordPress blog, they can be one of these three categories.
- Approved comments – WordPress has detected that these comments are real comments, and has immediately approved these comments
- Pending comments – These comments pass the spam filter, but either WordPress feels they they are some sorta “non human”, or it violates some of the rules you have laid in the blog discussion settings.
- Spam comments – If you have the very handy Akismet in place, commented identified as spam will go direct to spam comments.
If your blog is popular to any extent, you can expect to receive a lot of spam comments. These are easy to clear. All you have to do is to click on Comments -> Spam from your WordPress admin page, and you can clear them in one go, with the “Delete all Spam” button.
However, the issue comes when hundreds, or thousands of comments come in and they go into your moderation queue. This means they pass the spam filter.
WordPress allows you to mass delete these comments in the wp-admin – but only in batches of 20 at a time. When you have 853 comments waiting for “moderation”, well, you will start to realise batch deleting in 20s might not be a good idea (you have to do it over 40 times!)

Fortunately, there is a (somewhat) simpler way to do this.
Here are the steps.
#1 Log In to Your Hosting Backend
In my case, and in huge percentage of web hosts around the world, we use CPanel. Depending again on your hosting provider’s settings, the well-known way to access your CPanel is <yourdomain.com>/cpanel.
You will have to key in a username and password.
When you have successfully logged in, you will see a screen like this:

#2 Access Your Database Using phpMyAdmin
Look for the phpMyAdmin icon (under databases) and click on it. You should see a page like that when you are in the phpMyAdmin page.

Select your WordPress database by clicking on it on the left. You will see a list of tables within that database.
Next, locate the tabs on the right side, and find “SQL”. Click on that.
You will see this screen.

#3 Run the Following SQL command on your database
The command is this:
DELETE FROM wp_comments WHERE comment_approved = '0'
You should see a status message saying something like “853 rows affected”.
Then, you are done! Log back in to your WordPress admin panel, and you will find all the pending comments gone! Hurray!

Visit tyler
thank you! This was a huge help when my blog had gotten bot-blasted with spam — 132K comments in the space of a day. I’m set up with akismet now, so should be good
Visit @tankianann, Blogopreneur.com
Wow Tyler, 132K?! Imagine if you were to do it 20 at a time. You’d take 9 hours if you took 5 seconds for each batch of 20! Muahah
… and actually my client’s blog was already protected with Akismet, and these 800+ still came through.
Visit Sam
Wow, you’re a lifesaver! These have been pissing me off so much lately…finally installed akismet plugin and going to look into a few others, but there was NO WAY I was going to delete 21,000+ spam comments haha. Thank you!
Visit @tankianann, Blogopreneur.com
Pleasure to help, Sam.
Visit Kshitij Parajuli
My blog has 2 articles and I have 600 Pending Comments
Didnt think about it before. Thanks a lot!
Visit Cheryl Johnson
Thank you!!
In addition, if you are running WordPress Mu, you would need to add the number of each blog, so your command line would look like:
DELETE FROM wp_1_comments …..
Visit Christopher
Good info but when i browsed the interface I saw there was the option of clicking one icon to “empty” the entire wp-comment table (when mouse over it said truncate).
As i did not have any comments I wanted to preserve this was the fastest and easiest solution for me.
Once click and it was all gone including all the one already marked as spam WONDERFUL without your post I would not have looked at that option.
WARNING – The method I mention is only good if you want remove ALL comments.
Visit Jimmy MRR2
Good tips. However it only work best if we want to delete all comments. It will be bad if we mistook any real comment in the pending for spam.
Visit Delete Pending Comments from WordPress Blog | QUEEN OF KLUDGE
[...] Tan Kian Ann from Singapore describes how to do it here along with all the necessary screen shots. You do need to feel comfortable messing around with your database … but it is not that difficult! [...]
Visit Aaron
Thanks alot. Worked like a charm! 14,000 deleted in one quick sweep!
Visit Golden Brewski » Blog Archive » Delete Pending Comments from WordPress Blog
[...] Tan Kian Ann from Singapore describes how to do it here along with all the necessary screen shots. You do need to feel comfortable messing around with your database … but it is not that difficult! [...]
Visit 5k comment on my head
Hello, thanks for the detailed description. I went into blue host, and found myPHPadmin but I don’t know which WordPress database is the one I want to delete all the comments on. It’s listed as:
_wrdp01
_wrdp02
_wrdp03
…..
Which one is it?
Visit 5k comment on my head
I found it.. but.. it didn’t work..
I’m using a different template, so I think that is why this cannot be done.. it came up with the following:
Deleted rows: 0 (Query took 0.0003 sec)
Hmmm.. why?
I using a review type of theme.
Any other methods?
Visit 5k comment on my head
Got it solved.. My bad..
Choose the wrong database with nil comments.. sql is not that bad after all, NOT SO SCARY as i thought. Easy peasy..
http://www.drostdesigns.com/how-to-mass-delete-comments-from-wordpress-using-phpmyadmin/#comment-333095
MORE COMPLETE INFO….
Visit Hey
Your f****** command doesn’t work and my blog has turned off!!!
test the things before publushing them!!
stupid a******!!!
Visit @tankianann, Blogopreneur.com
Mr Hey,
I’m sorry to hear your plight. The command works and it has worked for many others as well. Please read the warning right before the SQL command.
Visit Papabear
I can’t tell you enough how much I appreciate this and how much time you just saved me. I giggled when you mentioned the huge number of 853 messages. When the script finished I had the huge sigh of relief when it said 9465. Those 9000+ spammed messages has been a weight around my neck for over a year. They arrived before I understood how comments worked or that there were such things as anti-spam scripts. I had no way to remove them except for 20 at a time and I’m not that bored.
Thank you 9465 times
Visit @tankianann, Blogopreneur.com
Its my pleasure Papabear!
Visit Bill
Thanks very much for this. It didn’t work for me, as the comments showed up as “approved.” I took a chance and changed the 0 to a 1, and it worked like a charm. My blog’s still there, too!
If you spam comments are “approved”, try this:
delete from wp_comments where comment_approved=1
Visit @tankianann, Blogopreneur.com
Hey Bill,
Gotta be careful that one, if you are running a blog that has already has a lot of comments. That deletes all approved comments – including the good ones!
Visit firexis
Thanks much for the tip. It’s helped me clear some 5000+ spam comments from my recently revived blog.
One thing to add: It’s safer to check beforehand how many comments will be deleted without first deleting it – think peace of mind.
The following SQL will return the number of comments that will be deleted:
SELECT count(*) FROM wp_comments WHERE comment_approved=0;
The result should match the number of comments awaiting moderation. Only then do you run the “delete” SQL:
DELETE FROM wp_comments WHERE comment_approved=0;
Thanks again for the tip
!
Visit OmniTechNews » Blog Archive » How to All WordPress Spam Comments
[...] The other day on my personal website: rjfc.net I found out that I had 10,000 spam comments. They had all been accepted and there was no way I could manually delete each one. I was looking on the web for about an hour and stumbled across an article on how to delete all accepted comments. Here is the link to the article: http://www.blogopreneur.com/2009/04/08/mass-delete-pending-comments-from-wordpress/ [...]
Visit sooran
tancks.
This Post Helped me
Good Time
Visit Donna Baxter
Visit Bob
Great Tip and clearly explained!
Visit Mohsin Rasool
Hi Tan,
Wow you have shared this method in detail… I just posted the same tip at my blog but i have not added those screenshots.. thank you for giving me ideas, if needed i will add screenshots to my post to.
Keep up good work.
Regards,
Mohsin
Visit Laura
Thanks so much for this post. You just saved me deleting over 4,500 spam comments by hand! I now have Akismet installed so hopefully I can prevent most of the spam comments from here on out. Again, many thanks for your time-saving post.
Visit Chuck Aikens
Just ran the command and eliminated 25,000 comments and immediately installed Akismet, not sure how I missed it. Thanks for the info.
Visit Veronika
THANK YOU!!!! This has saved me a lot of angst. 7000 comments gone in a wink
Visit Amit
seriously, you really helped me…. Cheers !!!! deleted 790 spam comments in one go.
Visit Adam Hermsdorfer
Thank you! This saved me a boat load of time today.
Visit Jason Schiffer
Thank You. I had over 4,500 comments and I too do not enjoy deleting comments and wasting hours of my life on senseless crap. You would think wordpress would have this in the comment section by now…but they don’t. I even looked around for plug-ins that had additional functionality…but none. running sql commands are scary..but as long as it works thats just find with me.
Visit Lindsey
I had 30,000. Now I have zero. yay.
Visit 3 Ways To Delete All Pending Comments With One Click In WordPress – Gnoted.com
[...] will not write about this way of doing this, because Kian Ann of Blogopreneur already wrote a nice post with detailed instructions on how to do [...]
Visit Jamazoo
Yay! 8000 spam comments gone!! Thank you so much!
Now to install Askimet like I should have in the first place, and then write a post about your helpful advice. Thanks again.
Visit Jamazoo » Delete your comments in bulk
[...] you would like to know how to delete wordpress comments in bulk, then you can find your wordpress help here. A nice little guide to get rid of those kind comments about your [...]
Visit John Ireland
Thanks for the info, it saved me from the madness of manual deletion. One note, the new Wordpress release allows you to change the number of comments posted per page to review (more than 100 seems to freeze it up though).
Visit phil
Thanks! 4,000 spams gone in 0.001 seconds.
True John Ireland; I set it to show 500 comments on the page – boy was that a mistake.
Visit BoB
Man, thanks so much!
http://smctracking.com/Tuca.jpg
Almost 34K, not too bad.
Visit @tankianann, Blogopreneur.com
LOL BoB. I like your graphic!
Visit Infographiste
Yeah very expressive lol, thans for sharing the tuto, very helpful
Visit QuicKutz Shellie
I just deleted 32,036 spam comments with your instructions. Thank you so much!