How to Mass Delete Spam Comments at once using a SQL query?
I have observed that among web masters, even though success in not so very common, the problems that they face are common! I have had many web masters seeking help when they are facing issues with Spam Comments and they are finding it difficult to keep a tab on them even after installing Akismet plugin that helps in spam identification.
Let me clarify that the problem here is not in the identification of the Spam comments, but is in mass deleting all of them at one go without crashing your Wordpress installation. Often the “empty spam” button works like a charm when there are less comments like below a count of 1000. Imagine you have an amount of 20,000 pending comments – how would you tackle such a situation to delete all the spam comments? its simple, read on..
Mass Deleting un approved comments using a SQL query
Login to your PHPmyadmin through the hosting control panel and select the database used by the WordPress installation. Click on the “SQL” menu item and paste the below query in the text box. Make sure you backup your database before you run the query (as a proactive step to recover a disaster if it occurs).
DELETE FROM wp_comments WHERE comment_approved = 0
The above query is a simple query that identifies all the comments that are not approved and deltes them. This methods does not take more than a second. For deleting around 49,000 comments from my WP dashboard it took me about 2 seconds, isn’t that smart work? dont waste your time deleting a 15 count 1000 pages from your WP dashboard and waste your time! Hope this simple tutorial has helped you to learn on How to Mass Delete Spam Comments at once using a SQL query?