It has happened to me before where I left comments on on a blog and didn’t mean to, and after awhile when I finally put focus back on the blog, I saw that it was littered with spammy comments. The type of blog that it was, it wasn’t appropriate to have comments, so I disabled them, but I also wanted to go back and delete all existing comments.
Other times it might be that I do in fact want people to be able to leave comments but I left the site unattended for too long and didn’t implement any comment spam protection technology into the site. In that case it’s often easiest just to delete all comments and start anew after implementing better spam prevention practices.
In this article I am going to explain a few different ways for deleting all the comments on a WordPress site, then I will show how to turn off commenting if desired. After that I will discuss a couple quick ideas for keeping spammers away from littering your comments.
Deleting Mass Amount of Comments from WordPress With a Couple Clicks
You can actually delete multiple comments from WordPress at one time right from the Dashboard. By default though, you can only delete 20 at a time. There may not be too many so this may not be a problem. But if you have say… 1,600 spam comments, suddenly you are having to do this 80 times.
If you go to the Comments menu in the WordPress Dashboard, you will see the checkbox that allows you to select multiple comments. But as mentioned, they are paginated and only show 20 at a time. That number can be changed by clicking Screen Options at the top of the screen. You can specify a new number and click Apply. This can be helpful, but it will still be slow and cumbersome and sometimes impossible for you to delete 1,000’s of comments at one time. There are better ways.
Using a Plugin to Delete WordPress Comments
One way is to use a plugin. There are probably plugins that will allow you to delete only specific comments. Perhaps you can delete all comments, all unapproved comments, just spam comments, etc.
A quick search led me to the Delete All Comments plugin. I have never used it though so I can’t comment on it’s efficacy (or safety).
Delete Comments from the Database Directly Using phpMyAdmin
If you have access to phpMyAdmin and are comfortable being in there you can jump in and do a quick backup of the SQL, then run an SQL command or two to delete the comments.
A few options:
DELETE FROM wp_comments WHERE comment_approved = “0” – for unapproved comments
DELETE FROM wp_comments WHERE comment_approved = “1” – for approved comments
DELETE FROM wp_comments WHERE comment_approved = “spam” – for comments marked as spam
DELETE FROM wp_comments – for all comments
Be sure of course to replace the table prefix. You are using a table prefix other than the “wp_” default right?
You can also just go in and find the comments table and click on “empty” to get rid of everything in there.
Disabling Comments on your WordPress Site
You can disable comments on a post by post basis but to do it globally perform the following steps.
1. Go to the Discussion Settings by visiting Settings >> Discussion in the WordPress admin.
2. “Pings” show up as comments as well so you can remove those too. To do so, uncheck the box that says “Allow link notifications from other blogs (pingbacks and trackbacks).” The box below that that reads “Allow people to post comments on new articles” is for turning off comments.
There are settings on the same page that make it slightly more difficult to have a comment publicly published. That coupled with some anti-comment spam plugins could allow you to keep comments on but with a lot more control.
Keeping the Database Clean(er) of Spam
Spam is a never ending problem and there will always be some that slip through but the Akismet plugin does a great job of keeping a lot of the spam out. It also has a “Delete All” button to get rid of the lot of comments. You need an API key from WordPress.com to use it which costs money if using the plugin in a commercial environment.
On one of my sites I installed the JetPack plugin (without Akismet) and applying some of the comment related features within it has reduced comment spam on my blog significantly.