Mark just asked me how can he delete more than 6000 spam comments he received on his blog during his holidays.
Mark just asked me how can he delete more than 6000 spam comments he received on his blog during his holidays.
First of it all, backup your WordPress database. Then, login to your phpmyadmin, select your WordPress blog database and click on SQL:

Then, insert the following sql command:
DELETE from wp_comments WHERE comment_approved = '0';
All non-approved comments we be deleted. But instead of having such trouble next time, you should definitely install Akismet!
29 Responses
Thanks a lot Jean, it worked like a charm!
Glad it helped!
Oh thank god, I had one of my websites hacked via a plugin, forgot to reinstall Akismet, and was trying to figure out how to delete 32k spam comments. You’re a lifesaver!
great, there’s bunch of comment in my blog
WordPress 2.7 now has cool native “Delete all spam” button.
Worked perfect!
I’m using a different template, so I think that is why this cannot be done.. i 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?
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….
Generally I do not post on blogs, but I would like to say that this post really forced me to do so, Excellent post!
I don’t know If I said it already but …Hey good stuff…keep up the good work!
I read a lot of blogs on a daily basis and for the most part, people lack substance but, I just wanted to make a quick comment to say I’m glad I found your blog. Thanks,)
A definite great read….
Fantastic! Thanks!
Thanks for pointing that out, Rarst! I never noticed it! I never liked working with MySQL.
Very helpful, thank you!
useful information. If that command doesn’t work, try the following:
DELETE from wp_comments WHERE comment_approved = ‘spam’
It worked! Thanks much. I deleted 39,500 spam comments with a single SQL command instead of deleting 10 comments at a time from inside the WP site admin module! That’s fantastic. I tweeted this as well. Have a great day!
Hey thanks. This is one of the reason’s I’ve been avoiding wordpress for my blogs.
Thank you
Life Saver!!!
hosting a site for a friend that has not touched their site since install and got a frantic call from today, almost a year later.
over 100k comments, majority approved somehow. I was getting ready to delete the entire install, but found this at the last minute.
Thank you, thank you, thank you….
Trackbacks: