Managing comments on your WordPress site via PhpMyAdmin or SQL

One click option, to remove unwanted comments from your WordPress websites. If you are using multiple WordPress websites, this should help you to save many hours. If your WordPress sites are not properly configured against Spam comments, you may receive 100s of comments per day or week. You can remove those comments from the WordPress dashboard.

Access WordPress dashboard → Click on "Comments" from the left side tab → You can sort and select comments from there → Select bulk action

Here, you can only select a maximum of 20 comments. And if you have to remove 1000s of emails then there is a smart solution for this.

To remove unwanted comments from a WordPress site

The comments are categorized as PendingApprovedSpam and Trash. Here you can select anyone of this to execute the MySQL query.

Step 1 : Log into cPanel and access PhpMyAdmin.

Step 2 : Select the database correctly.

Step 3 : Click on the SQL tab; then execute your query.

 

Managing approved comments

You can select all approved comments by executing the following command:

use database_name;
select * from wp_comments WHERE comment_approved='1';


To remove all approved comments from your WordPress’s database, use the following query:

use database_name;
delete * from wp_comments WHERE comment_approved='1';


Select and remove all unapproved comments

Here replace 1 in the above command to 0, that’s it.

You can select all unapproved comments by executing the following command:

use database_name;
select * from wp_comments WHERE comment_approved='0';


To remove all unapproved comments from your WordPress’s database, use the following query:

use database_name;
delete * from wp_comments WHERE comment_approved='0';


Managing Spam and Trash comments


You can select all Spam comments by executing the following command:

use database_name;
select * from wp_comments WHERE comment_approved='spam';


To remove all Spam comments from your WordPress’s database, use the following query:

use database_name;
delete * from wp_comments WHERE comment_approved='spam';


You can select all Trashed comments by executing the following command:

use database_name;
select * from wp_comments WHERE comment_approved='trash';


To remove all Spam comments from your WordPress’s database, use the following query:

use database_name;
delete * from wp_comments WHERE comment_approved='trash';

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)