How to remove all comments from Wordpress.

As you can see that I hardly blogged for last 4 months. When I logged in to my Wordpress console today, I found around 50k comments – most of them spam. Its not humanly possible to delete all of them manually.

The best way of getting rid of a bunch of un-approved comments from Wordpress is to manually remove from the database. Please backup your database before you use this technique.

First, go into phpmyadmin and select the database wordpress is using, and hit the SQL tab.

Execute the following query in the SQL section of phpmyadmin

SELECT * FROM wp_comments WHERE comment_approved =’0’

This this will output a number. Make sure this is the exact same number as the amount of pending comments you have in the wordpress admin panel. It should be. If it isn’t you have some serious problems which I can’t help you with.

Now that we have isolated the pending comments, time to delete them all. Go back into the SQL section and enter this command

delete from wp_comments WHERE comment_approved =’0’

You are done.

No comments: