Managing tasks via PhpMyAdmin is the fastest and effective way of completing the tasks. Via MySQL commands you can do bulk works like removing unwanted comments from your WordPress website. If you are receiving thousands of comments in your WordPress websites daily, then this tutorial will help you to delete spam comments from your site quickly. If you want to avoid further spam comments then I will say, you must use the plugin Akismet which identify and block the spam comments and delete the comments automatically.
You can delete the bulk comments from WordPress also using the bulk option inside the WordPress comments page which is inbuilt provided by WordPress but if you process then it will take a long time for the process to complete. Though 20 comments are deleting does not take much time, but if you are planning to delete 1000 comments, then it is painful work. Sometimes you might be feeling pain in your head when you find you are getting an error too many redirections in our previous article we discussed the fix.
So there is an easiest way to delete all the spam comments from PHPMyAdmin, and within a few moments, all of your Spam comments will be removed. So let’s get started with the work for deleting the comments.
Remove comments from your WordPress site?
WordPress comments are always categorized as Pending, Approved, Spam 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 (wrong database means the wrong WordPress will be updated or deleted).
Step 3: Click on the SQL tab; then execute your query.
Note: Make sure wp_ is matching with your database table prefix.
Delete all approved comments by executing the command:
use database_name; select * from wp_comments WHERE comment_approved='1'; use database_name; delete * from wp_comments WHERE comment_approved='1';
Delete all unapproved comments by executing the command:
use database_name; select * from wp_comments WHERE comment_approved='0'; use database_name; delete * from wp_comments WHERE comment_approved='0';
Delete all Spam comments by executing the command:
use database_name; select * from wp_comments WHERE comment_approved='spam'; use database_name; delete * from wp_comments WHERE comment_approved='spam';
Delete all Trashed comments by executing the command:
use database_name; select * from wp_comments WHERE comment_approved='trash'; use database_name; delete * from wp_comments WHERE comment_approved='trash';