Qi Theme

Qi Theme – a completely free WordPress theme with 100 modern demo websites

Learn More
Sign up for our newsletter and be the first to get all the latest Qode news and updates.
BACK TO TOP

How to Easily Bulk Delete All WordPress Comments

How to Easily Bulk Delete All WordPress Comments

Comments are a great tool for interacting with your audience and getting their feedback. Comments have been a part of WordPress for a long time and they are present across a vast number of websites. However, allowing comments on your website attracts spammers, which are a headache for every website owner. Even with the best anti-spam plugins protecting your website, spammy comments can accumulate. Then, it’s easier to simply delete all the comments you have on your WordPress website to deal with this problem.

However, if you’ve been running your website for a while, you might have accumulated a great deal of WordPress comments. As such, deleting all of them manually, one at a time, would require a lot of effort and time to accomplish. Then it becomes a priority to find a quick solution for bulk deleting comments in those kinds of situations. In this article, we’ll take a look at how your WordPress site could benefit if you delete all comments and we’ll explore several ways of doing so:

Why you may need to bulk delete all WordPress comments

Despite their usefulness, you need to moderate your comments if you want them to have a positive impact on your website and its content. But, moderating comments properly can cause headaches, particularly if you attract a lot of spam, malicious links, or promotions. And if your site tackles any controversial topics, there could be a lot of inappropriate and offensive comments, as well. All of it gives a bad impression of your website to new visitors.

To deal with all of that, webmasters use different measures, such as deleting some comments or disabling commenting altogether. And, if the amount of unwanted comments is too large, you can delete them all and start over with a clean slate.

Additionally, if you’ve added a lot of dummy comments during the development stage of your website, you should remove them all before launching your site. Inserting dummy content, such as comments, during website development will help you see how a certain functionality looks and works on your site. However, if you plan on making your website public by migrating to a live server when it’s done, you will need to delete those dummy comments. Otherwise, they will hurt your website’s SEO and confuse your readers.

If you find yourself in a situation similar to one of these, you should consider cleaning up your WordPress website by deleting all comments.

Qode Themes: Top Picks
Bridge New Banner
Bridge

Creative Multi-Purpose WordPress Theme

Stockholm WordPress Theme
Stockholm

A Genuinely Multi-Concept Theme

Startit WordPress Theme
Startit

Fresh Startup Business Theme

How to bulk delete all WordPress comments

Now that you have a clearer picture of how deleting all your WordPress comments can benefit you, let’s examine how you can do so. In the following sections, we will explain three possible approaches for deleting all WordPress comments. We suggest you go through all three and consider each before deciding which one suits you best.

However, deleting comments is an irreversible action, therefore you should make a website backup in case you change your mind later on. This is also an important safety precaution against any unforeseen issues during the process as well as a recommended practice for all site owners. Once you’ve done that, you can proceed as outlined below.

Using the WordPress dashboard options

The most obvious way of bulk removing WordPress comments is by using the options for bulk removal provided within the WordPress dashboard. However, this method is most suitable for users who have a lower number of comments on their website. There is a way to increase the number of comments you can bulk delete at once, and we’ll show you how that’s done. But, if your website has thousands of comments, you should consider using one of the other two methods we will discuss later, instead.

To remove all comments using the dashboard options, navigate to the Comments section. Then, make sure you’re located within the All tab, which displays all comments from the categories: Mine, Pending and Approved. Tick the checkbox next to the Author label near the top of your screen. This will select all the comments displayed in the list on your screen.

All Comments

By default, the number of comments that are displayed per page is 20. If your site has more than that, you will get page navigation links below the comments list. This means that you’ll have to repeat the same steps for each page of comments in order to delete them.

As this can be quite tedious, you can increase the default value of 20 to a higher number, which will speed up the process. However, keep in mind that displaying a very large number of comments can hurt your website’s performance or even cause it to crash. Therefore, you should try to aim for a number that shortens the deletion process, but doesn’t hurt your website performance too much.

To increase the number of visible comments, start by clicking on Screen Options in the top right corner of the Comments section. This will open a subset of options that were previously hidden. Then, to increase the default number of comments that are displayed per page, insert the new value in the Number of items per page field and click on the Apply button below.

Comments Number of Items

Once you’ve increased the number of comments that can be displayed on each page, you should proceed to move the comments to the Trash. To do so, make sure all the comments are selected, then click on the dropdown where it says Bulk actions. From there, you need to select the Move to Trash option. Then, click on the Apply button next to the dropdown to bulk apply your action.

Move All Comments to Trash

Moving all your comments to Trash means that they will be located within the last two tabs—Spam and Trash. Therefore, you only need to empty those two tabs to finish the process of permanently removing all WordPress comments. To empty the Trash tab, click on it to open and then press the Empty Trash button found within.

Empty Trash

Depending on the number of comments, you might need to wait a bit for the action to be completed. When it’s done, you will see a success message near the top of your screen.

Comments Deleted

Afterward, navigate to the Spam tab and press the Empty Spam button to remove the remaining comments.

Empty Spam

Similarly, a success message will be shown after it is done.

Spam Comments Deleted

Once again, we have to reiterate that the previously mentioned actions have to be repeated for all comments, in case your comments pagination has two or more pages. By performing those actions, you will remove all WordPress comments and their relational metadata. We will touch more on this subject in the following two methods of bulk deleting WordPress comments.

Using a WordPress plugin

Given the large selection of different WordPress plugins, finding one for deleting WordPress comments is quite easy. You can either look for plugins that are made for altering comments specifically or ones that alter the database in general. When looking at the latter, make sure to pick a plugin that enables you to delete targeted data. This can be through an intuitive set of options or by allowing you to target specific database tables. However, working with the database is more suitable for advanced WordPress users, and if you opt for this approach, you should make a database backup first. Then you can edit the wp_comments and wp_commentmeta database tables, where the comments and comment metadata are stored without worry.

The plugin which we opted to use for this article falls under the database-altering category and is called WP Bulk Delete. The plugin is perfect for removing database bloat in general or removing one type of data in particular. It allows you to bulk delete posts, comments, users, terms, and taxonomies, as well as any orphaned metadata from your database. While the option to delete the same data based on filters and conditions is reserved for the premium version of the plugin, you can still use the free version on your WordPress site to delete all comments. We will explain how to do this below.

After installing the plugin, navigate to WP Bulk Delete > Delete Comments. In this section, you will be able to review comment-related options, although some will be available only with the premium version of the plugin.

To delete all comments from your website, tick the checkbox next to all types of comments in the Comment Status subsection. Then, click on the Delete Comments button below.

WP Bulk Delete Comments

Afterward, you will be prompted to confirm your choice. If are sure that you want to delete all comments from your website, click on the Ok button to proceed.

Delete Comments Confirm

Shortly after, you will see a success message similar to the one shown below, specifying how many comments were deleted.

Plugin Comments Deleted

However, this might not be enough to thoroughly remove all traces of the comments from your site. Since a WordPress website relies on a MySQL database, which is a relational database, some data pointing to those comments might still be present within the database. Removing the comments makes this data obsolete, and it should be removed to optimize your database storage space. The technical term for this kind of data is orphaned, and you can find its mention in various WordPress plugins that have database-optimizing capabilities. The plugin we chose to showcase in this article can help you with this as well.

To delete any orphaned data, navigate to WP Bulk Delete > Delete Meta Fields and make sure you’re in the Cleanup tab. We will focus only on the orphaned metadata in this article, but it might be helpful to know that this plugin also offers the possibility to delete any duplicated post, user, or term metadata.

Tick the checkbox next to any orphaned metadata option that has more than 0 rows you can delete. In most cases, since you have deleted the comments, you will only need to tick the checkbox next to Orphaned Comment Meta. However, you might need to tick some of the other options as well, to include all data concerning comments you deleted. Let us explain why this happens.

Some WordPress plugins or themes may place comment-like content inside the wp_comments and wp_commentmeta tables. This includes reviews and customer notes, for example. By removing the comments, we deleted all types of entries within the wp_comments table, which encompassed those added entries as well. With that, we created orphaned term metadata within some other tables that are used by your theme or plugins and that reference the added data.

Therefore, to completely remove the orphaned metadata, you should remove the orphaned term metadata as well. In the case you didn’t want to delete that added data, you can restore the website backup you made and then bulk delete all comments from the WordPress dashboard. With that being said, let us explain the remaining part of deleting the orphaned metadata.

Once you’ve ticked the appropriate options, you can click on the Run Cleanup button below.

Delete Meta Fields

In this case, you won’t be prompted to confirm your choice. Instead, it will be executed and, shortly after, you will see a success message similar to the one shown below.

Meta Deleted

Using phpMyAdmin

Whereas the previous two methods are suitable for a wide range of users, this last one is geared towards more advanced WordPress users. This method requires you to be somewhat familiar with the structure of a common WordPress database. However, it will let you remove all comments and comment metadata very quickly. This is achieved by deleting all the rows from the wp_comments and wp_commentmeta database tables.

As we mentioned in the previous section, some themes and plugins can insert data similar to comments inside those two tables. This data could represent things like reviews and notes, for example. And it will be deleted once you empty the two database tables in question.

With that being said, to delete the contents of those two database tables, you will need to access the phpMyAdmin application. This can be done within cPanel or, if you’re working on localhost, by accessing the your-server-name/phpmyadmin address. We assume your site is already live, so we will focus on showing you the former.

After logging into cPanel, click on the phpMyAdmin option found within the Databases section.

phpMyAdmin

The phpMyAdmin application will open momentarily. Within it, locate the database of your website and click once to access it.

phpMyAdmin Test

If you aren’t sure what is the name of your database, you will need to inspect the wp-config.php file. More precisely, you need to look for the following line of code, which will have your database name in it:

define( ‘DB_NAME’, ‘database_name_here’ );

For more details about the content of this file, you can take a look at our article on working with the wp-config.php file. Once you’ve figured out the name of your database, you can proceed with the steps.

Next, locate and select the comments and commentmeta tables. If you haven’t changed the default WordPress prefix, they will be called wp_comments and wp_commentmeta, respectively. Otherwise, they will have the database prefix you have set. Then, locate the With selected dropdown menu at the bottom of the screen and select the Empty option from it.

phpMyAdmin Empty Comments

You will be prompted with a warning, asking you to confirm the choice that you made. The option will be replaced with the following two queries which are equivalent to the option you chose:

TRUNCATE `wp_commentmeta`;
TRUNCATE `wp_comments`;

If you are sure that you want to empty those two tables, i.e. delete all the comments and comment metadata, click on the Yes button.

phpMyAdmin Confirm

Depending on the number of comments you had on your website, all the comments data should be deleted shortly after.

Final Thoughts

WordPress comments are a great way of fostering relationships with your visitors. They can let your readers interact and your customers build a loyal base. However, comments can also be a gateway for a lot of spam. It is up to every WordPress webmaster to decide whether they want these comments on their website, and to remove them quickly before the spamming issue becomes severe. However, you can clear your WordPress site and delete all comments quickly and easily by following any of the three methods we described in this article. And, to ensure no harm comes from this process, we highly recommend creating a backup before you start working.

Post your comment

Comments0