Mass Delete WordPress Comments

Every once in awhile you may find yourself needing to mass delete WordPress comments in bulk for either SPAM comments, pending comments, approved comments or already trashed comments.

With access to your database and the ability to run a SQL command you can do any of the above with the proper line of SQL. I keep the below in a quick reference sheet but figure that other’s may find these useful, please use as needed but with caution. The below will remove comments from the default database prefix wp_.

*Always have a backup of your database before making large edits.

Mass Delete WordPress SPAM Comments

DELETE FROM wp_comments WHERE comment_approved = 'spam'

Mass Delete WordPress Pending Comments

DELETE FROM wp_comments WHERE comment_approved = '0'

Mass Delete WordPress Approved Comments

DELETE FROM wp_comments WHERE comment_approved = '1'

Mass Delete WordPress Trashed Comments

DELETE FROM wp_comments WHERE comment_approved = 'trash'

About Gabe Diaz

Gabe Diaz is web professional and consultant focusing on design and development, currently based out of South FL. When not geeking out on the internet you will find him spending time with his children. You can also find him on Google+: +Gabe Diaz, Twitter: @GabeDiaz and Facebook: GabeDiaz.

25. March 2014 by Gabe Diaz
Categories: Blog | 1 comment

One Comment

  1. thanks for this tip sir…lot of spam on my site.

    thumbs up

Leave a Reply

Required fields are marked *