We do not really need wordpress comments option for websites most of the times. After developing a website in WordPress we often forget to disable comments. And that is what attracts the spammers. Spammers fill out comments option with bots and tries to create backlinks from your website. These garbage comments also increases the database size and creates pressure on the server. The comments option in WordPress doesn’t allow us to delete more than 20 comments at a time. If your website has been bombed with spams – it may have thousands of them before you realize those are there. So it becomes a hectic job deleting 20 such comments from the WordPress dashboard.
In such circumstances – you may delete all of those spam comments from the phpMyAdmin panel or using MySQL queries in database tools. Here is how you may delete such spam comments from the phpMyAdmin:
1. Go to the phpMyAdmin panel (Most of the hosting platforms offer it).
2. Click on the database in the left panel (you may have other databases there)
3. Click on the “wp_comments” table in the left panel or in the main page in right. (Assuming database table prefix is “wp”. replace “wp” to whatever else you have set as database prefix).
4. Now in the right side page – click on the “SQL” tab at the top.
5. Now run the following query:
DELETE FROM wp_comments WHERE comment_approved = 0
(replace “wp” with the table prefix you have in your wordpress database)
The above query will delete any comment which you haven’t approved.