How to delete all comments in WordPress? | AltusHost

How to delete all comments in WordPress?

How to delete all comments in WordPress?

Altus Host

Forms on the website without more sophisticated measures of bot prevention, such as Google Recaptcha or Cloudflare Turnstile are often targeted to send spam emails, therefore if you have a problem with SPAM comments and thousands of comments on your website, in addition to deleting the comments you should also activate bot-prevention methods on your comment forms.

It is important to note that not all bot-prevention methods are foolproof, and some can even pose a challenge to human users. Captchas, for example, can sometimes be difficult to read, frustrating users and driving them away from your website. Therefore, it is important to strike a balance between security and usability when implementing bot-prevention methods. Nevertheless, taking steps to prevent spam bots from infiltrating your website can save you time, effort, and headaches in the long run, allowing you to focus on creating great content and engaging with your audience.

Deleting comments using a WordPress plugin

The simplest way to delete all comments on a WordPress site is to use a plugin such as Bulk Comment Deleter

After installing the plugin, navigate to the comments screen and click on one of the three buttons to delete unwanted comments:

  • Delete All Unapproved – This option will let you delete all Unapproved (pending) comments.
  • Bulk Delete SPAM – This option will let you batch delete every SPAM comment.
  • Delete ALL – This option will let you delete ALL comments on your WordPress website.

Deleting comments from the MySQL database

WordPress uses the wp_commentmeta and  wp_comments tables in the database to store all comments on the site.

In order to delete all comments on the site, you can access the site’s database from PHPMyAdmin and delete comments from there.

First, from cPanel, click on the PHPMyAdmin icon:

Then, on the left, select the name of the site database for which you want to delete all comments:

Deleting all comments on the site

Click on the SQL link at the top of the page and enter the command in the field:

TRUNCATE `wp_comments`;

TRUNCATE `wp_commentmeta`;

In the command, replace the table prefix wp_ with the prefix you use on the site. You can see the prefix inside the wp-config.php file

and then click the Go button .


Deleting only SPAM comments on the site

If you want to delete only SPAM comments on the site, instead of the above command, use:

DELETE FROM `wp_comments` WHERE `comment_approved` = ‘spam’;


Deleting only unpublished comments on the site

If you want to delete only unpublished comments on the site, use the command:

DELETE FROM `wp_comments` WHERE `comment_approved` LIKE (‘0’);


As we mentioned at the beginning of the text, while SPAM comments can be a nuisance for website owners, they are unfortunately a reality of online publishing. In addition to deleting all comments, it is necessary to also secure the forms. However, by taking proactive measures to secure your website forms and prevent bots from infiltrating them, you can significantly reduce the number of unwanted comments and free up your time to focus on more important aspects of your website. So, if you’re struggling with SPAM comments, don’t wait any longer. Take action today and implement the necessary bot-prevention measures to safeguard your website and ensure a more pleasant user experience for you and your visitors.

Website | + posts

Leave a Reply

Your email address will not be published. Required fields are marked *

Recent Articles