How to delete all comments on WordPress; 3 easy ways to delete Spam and Trash comments

0


WordPress logo
WordPress logo

Comments are a good way to build a strong relationship with your readers and general audience but there can be situations when an Administrator wants to remove all comments from their WordPress site.

If, for example, the website is new and the spam filters have or yet been set up correctly, it may not take long before the comments section build up with spam comments from bots and webmasters trying to improve their own site’s SEO (search engine optimisation) with comment back links. Alternatively, the Administrator may have created dummy comments for testing purposes that are no longer required when the site is productive and live.

Spam comments may affect the user experience and, as a result, they should be deleted by the website Administrator as soon as possible so as to avoid any negative effects on the site’s SEO.

How to delete all comments from a WordPress installation

There are a number of different ways to delete all of the comments from a WordPress installation and here we list just three of them.

Use the WordPress Administrator Dashboard

The first way to delete all comments from a WordPress installation is to use the WordPress Administrator Dashboard.

Wordpress Delete All Comments
WordPress Delete All Comments

You can delete all comments quickly from your admin dashboard by using the Comment menu.

  1. Through your WordPress admin dashboard, you can navigate to the Comments section.
  2. On the Bulk Actions dropdown menu, select the Move to Trash option. Then check the tick box to select all comments and click Apply.

Note that with this method, you will only be able to delete one page of comments. Usually the default number of comments per page is 20. You can increase this number by increasing the Number of items per page in the Screen Options (usually found on the top-right corner of the screen).

Use a WordPress plugin to delete all comments

There are a number of WordPress plugins on the market which you can use to delete all comments from your WordPress installation. Some of these plugins are completely free and some of them have a free basic version and premium addons for more complex requirements.

Here are a few plugins to delete all comments from your WordPress installation:

  1. WP Bulk Delete – This WordPress plugin enables you to remove various types of data in bulk. It includes, but is not limited to, comments. With this WordPress plugin you can implement filters and conditions based on your needs. There is a free and pro version.
  2. Delete All Comments Easily – With this WordPress plugin you can delete all comments from a WordPress installation very easily. However, the comments can only be restored from a backup.
  3. Delete All Comments of WordPress – This WordPress plugin is also used by the Administrator. It has been built to delete all comments (Approved, Pending) from the WordPress installation very easily with just one click.

Use MySQL shell or the Command Line Interface (CLI) to delete all WordPress comments

The third way to delete all comments from the WordPress installation is to use the MySQL shell or delete the WordPress comments directly using the command line interface (CLI).

This can be done by accessing the MySQL shell from the CLI and executing one of the following SQL commands below to delete all the comments from the “wp_comments” and “wp_commentmeta” tables.

To delete all non-approved and pending WordPress comments:

DELETE from wp_comments WHERE comment_approved = ‘0’; DELETE from wp_commentmeta;

To delete all approved WordPress comments:

DELETE from wp_comments WHERE comment_approved = ‘1’; DELETE from wp_commentmeta;

To delete all WordPress “Trash” comments:

DELETE from wp_comments WHERE comment_approved = ‘trash’; DELETE from wp_commentmeta;

To delete all WordPress “Spam” comments:

DELETE from wp_comments WHERE comment_approved = ‘spam’; DELETE from wp_commentmeta;

Conclusion

Each of the methods above have advantages and disadvantages depending on your skill set and the number of WordPress comments you wish to delete. One thing to remember, however, when making any major change to your WordPress installation… *ALWAYS* make a backup!

 

 

 

 

LEAVE A REPLY