Deleting Large Numbers of Comments from your Blog

developer

trash-can

Every New Year inevitably brings reflections, resolutions, and commitments to self improvement. One of  my biggest faults, is that I will generally put off jobs I don’t want to do until I can’t put them off any more. This fault was highlighted to me when I caught a glimpse of comments awaiting moderation for my blog… 3476!

“How did I let it get this far?? How long is it going to take to moderate all these comments, of which 99.9% are likely to be robots from an ‘extension’ company offering ways to improve performance in the ‘evening time’! Is there not a remove all button?”… These and many more questions ran through my mind as I desperately looked for ways to avoid manually deleting the comments 20 at a time!

If you’re wondering if there is a button to press on  WordPress that mass removes all comments, the short answer is not at this time. However, I did mange to get rid of all the comments without having to do them 20 at a time. Here’s how I did it… (To do this you will need access to the cpanel where your blog resides.)

Firstly it is always a good idea to back up your blog before you do any fiddling with it. If you don’t know how to do this you can find instructions here on the WordPress site

1. Once you have  backed up your blog, go into PHP My Admin in your hosting’s Cpanel.

cpanel

2. In PHP My Admin, to the left, you will see the blog database listed, click on it and a list of tables within the database will appear.

3. Now all you need to do is click on the tab ‘ SQL ‘ which is in the menu to the right in the main section. Clicking this will open the SQL command input area in which you should copy and paste the following command:

DELETE FROM wp_comments WHERE comment_approved = '0'

That’s it, if you log back into your blog you will see that all the comments awaiting approval will have been deleted.

The slate is wiped clean and you can promise yourself you will make a concerted effort to approve comments on a more regular basis henceforth 🙂