vHersey

Mass Remove WordPress Comments

I had an issue with some comment spam and ended up with a little over 30,000 comments between unapproved, spam, and trash in my WordPress comments – FTW! Would have taken me a week to move them all to trash and then delete them. Here is a quick way to mass delete comments using SQL queries in phpMyAdmin.

You may want to make sure you have a good backup of your database. A typo in one of these SQL queries could end up being a disaster.

In phpMyAdmin select your WordPress database and then click the SQL tab.

This query will delete all unapproved comments. It does not send them to trash or mark them as spam, it deletes them. The comments will be gone forever.

delete from wp_comments WHERE comment_approved ="0"

To quickly delete all comments marked as spam run this query:

delete from wp_comments WHERE comment_approved ="spam"

To quickly delete all comments in trash run this query:

delete from wp_comments WHERE comment_approved ="trash"

Hopefully you won’t find yourself in a position where you need to delete over 30,000 comments but if you do this should help.

Leave a Reply

Your email address will not be published. Required fields are marked *

thirteen − nine =