Comments can easily build up on a WordPress site, especially if you don’t have any anti-spam measures in place. It seems easy enough to get rid of them all, there are tons of plugins for this, but there are some nuances you should be aware of to make sure you’re deleting the right information, and doing a thorough job.
Let’s look at how to clean up this aspect of your WordPress site.
Table of Contents
- Watch out for these “gotchas”
- Manual Deletion of All Comments
- Delete All Comments with a Plugin
- Delete All Comments in WordPress using PHP MyAdmin
- Delete Comments in WordPress with SQL Commands
- Delete Comments Using WP-CLI
Watch out for these “gotchas”
Before we get into the “how-to” of it all, we should mention this pesky thing called
Information in your WordPress site is stored in the database, in tables. There is a table called
wp_comments, which is pretty much exactly what you think it is – the comments themselves.
However, there is an additional table,
wp_commentmeta, which may (depending on specific plugins) store optional, additional data about those comments.
So in order to keep a clean database, when deleting comments any associated meta data for those comments should also be deleted. Otherwise it becomes “orphan data” – data which is no longer attached to anything.
We’ll keep this in mind as we review the various ways to delete comments from your WordPress site.
Unexpected types of comments
The most common type of comment on your site are the ones left on blog posts. These are the ones you see when you go to the Comments type in your WordPress admin. Those have various statuses:
You probably already know that.
What you may not know is that other plugins may use comments for different purposes. For example, WooCommerce uses comments to store order notes:
This is important if you want to delete blog comments, but retain order notes, or other custom types of comments.
Back up your database first
I would be remiss not to mention that you should take a backup of your database first just in case you delete something unexpectedly. Otherwise the change is permanent and the data lost.
Manual Deletion of All Comments
If you don’t have a huge amount of comments to clean up, let’s say dozens or even a couple hundred, but not thousands, it can be done using the default tools available.
- In your WordPress admin, go to Comments
- Your screen will likely display 20 comments per page. To display and therefore be able to delete more comments at once, click on Screen Options to display more comments per page.
- Check the box next to Author so that all comments on the page are selected
- In the Bulk actions dropdown, select Move to Trash, then click Apply
- The trash will be automatically cleared by WordPress after 30 days. If you want to delete them instantly, click on the Trash menu and click the Empty Trash button
This method will get rid of the associated comment meta as well and won’t touch other types of comments like WooCommerce Order Notes.
But if you have thousands of comments to remove, this method is going to be very time-consuming.
There are various methods to more easily delete comments in bulk.
Delete All Comments with a Plugin
There are many plugins available which will help you mass delete comments on your site. Generally, they work fine but some have nicer interfaces than others and may do a more thorough job (re: commentmeta).
There are two plugins I would recommend – choose the one which seems best for your scenario.
Recommended for deleting standard blog comments: WP Bulk Delete
WP Bulk Delete can be used to remove any kind of content from your WordPress site, including comments.
After installation it adds its own menu tab which is a bit annoying and unnecessary, but this is the kind of plugin you can use once and then delete after using. You don’t need to keep it once it’s done the job.
To remove comments, go to: WP Bulk Delete → Delete Comments. You will have the following options:
- Delete comments by status: Pending, Spam, Trash, Approved
- Delete comments by date: comments older than x days, submitted in a certain timeframe
These options will delete all the selected comments with one click.
There are a couple of premium options like removing comments from specific authors and posts, as well as scheduling options. But for most use-cases, the free version will be enough.
Be aware that deleting approved comments will also delete WooCommerce order notes, or other comment types besides blog post comments and there isn’t a way to filter them out.
So this plugin will be best used when it’s only blog post comments that you want to remove. See the second recommendation below if you need more fine-grained control.
Note that pingbacks are also a kind of comment and will be deleted.
How to check if other kinds of comments will be deleted
If you’re not sure if comments are being used in other ways on your site, here’s an easy way to check: compare the number of Approved Comments shown by Bulk Delete, with the number of approved blog posts comments you have. If Bulk Delete shows more Approved Comments than you have post comments, it means comments are being used in another way on your site.
In most cases, deleting the comments as described above, removes only the comments themselves and not the associated commentmeta. This requires another step in WP Bulk Delete:
- Go to Delete Meta Fields → Cleanup
- Then choose Orphaned Comment Meta
Recommended if you need more control: Disable Comments Plugin
The other plugin I recommend for deleting comments is Disable Comments. It’s primary use, as you can guess by the name, is to turn off commenting ability on your site.
But it also has options to delete comments, with some useful features. If you run a WooCommerce site and want to preserve order notes, or your site uses other kinds of comment types that you don’t want to delete, this is the plugin for you.
It provides the ability to:
- Delete comments on specific post types (so you can delete comments only for posts, without touching products)
- Delete specific comment types (you can delete traditional comments without touching other comment types)
- Delete all Spam comments
- Delete all comments
Commentmeta is also removed.
I tested multiple plugins for this article and make the above two recommendations based on the user-friendliness of their interfaces, providing the necessary options, and doing a thorough job.
If you have Googled this topic before, you may see other articles recommending others including Delete all comments of website. It is very popular but I can’t recommend it due to the pretty terrible user interface which is loaded with requests to buy the developer a beer. It also does an incomplete job, without providing a way to clean up the commentmeta.
All in all, WP Bulk Delete and Delete Comments both provide a bit more control, with less of an eyesore.
If you are a developer and don’t want to use a plugin to remove comments, there are ways to directly manipulate the database to achieve the same goal.
Delete All Comments in WordPress using PHP MyAdmin
To delete ALL comments regardless of type or status (including WooCommerce order notes or other atypical comments):
- Access PHPMyAdmin in your hosting control panel
- Click on the database for your site – you will then be presented with a list of all the tables.
- Locate the table
wp_commentsin the list. (
wp_is the default prefix, but might be different if you used a security plugin or similar to change this for your installation).
- Click on EMPTY and press OK.
- Then you should do the same for the
If you need more fine-grained control over which types of comments to delete, see the next section for specific SQL Commands, or use the WP Bulk Delete plugin.
Delete Comments in WordPress with SQL Commands
If you want to remove a specific subset of comments you can also do this in PHPMyAdmin by running specific SQL commands. This is essentially what a plugin will do for you, but here you’re doing it manually.
This of course has additional risks- if you run the wrong query you might delete something unexpectedly.
To run a specific command on a table:
- Click on the
wp_commentstable from the list on the left
- Click the SQL tab at the top of the page.
- In the text field, Run SQL query/queries on table, paste the desired command from the list below
- If you are unsure about it, you can click Simulate Query first to see how many entries will be affected.
- When you’re ready to run it, click Go.
Delete spam comments
DELETE FROM wp_comments WHERE comment_approved = 'spam';
Delete pending comments
DELETE from wp_comments WHERE comment_approved = '0'
Delete approved comments
DELETE from wp_comments WHERE comment_approved = '1'
Delete comments in the trash
DELETE from wp_comments WHERE comment_approved = 'trash'
Delete only comments (and not order_notes or other types)
DELETE from wp_comments WHERE comment_approved = '1' AND comment_type = 'comment'
Delete Comments Using WP-CLI
If you like tightrope walking without a net, and enjoy using command line tools without a GUI (Graphical User Interface), you can use WP-CLI. This is a command line tool specifically for WordPress.
Please see the following resources for the specific details:
- Delete WordPress comments using WP-CLI
- And if you’re working at scale and need to delete massive amounts of comments, check out: Deleting 3 million spam comments from your WordPress database
So here you have several ways to easily delete comments on your WordPress site in bulk. I hope you find a method that suits you! We also have a separate guide if you would rather disable comments and the “leave a reply” text on your site, without deleting comments.