How To

How to delete mass comments in Wordpress?

If you have Akismet plugin active and your blog is getting lots of spam comments then you can execute a small query from the phpMyAdmin or any SQL command line to delete bulk spam comments instead of manual deletion.

1) Open the database in phpMyAdmin or any SQL command line.

2) Backup the database using export option from phpMyAdmin for safety purpose.

3) Open the MySQL query window and execute following command

 delete from wp_comments where comment_approved = "spam"

Note: Please replace above query with the database prefix the database is using. In this example, the database prefix is "wp".

4) Once the query is executed check the comments option from WordPress admin.

MySQL queries to delete mass  spam , trash, pending, approved comments from WordPress

To delete all pending comments:

delete from wp_comments WHERE comment_approved = 0

To delete all approved comments:

delete from wp_comments WHERE comment_approved = 1

To delete all trash comments:

delete from wp_comments where comment_approved = "trash"

To delete all spam comments:

delete from wp_comments where comment_approved = "spam"

If you face any problem and have any other wayto share kindly post as comment.

Abhijit Sandhan

Love to Automate, Blog, Travel, Hike & spread Knowledge!

Related Articles

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Back to top button