WordPress Tutorial

How to Delete WordPress Comments

How to Delete WordPress Comments

Introduction

WordPress comment spam is becoming an issue for every webmaster. If you do not have any spam protection setup on your WordPress blog, one day you might find yourself with thousands of spam/pending comments laying inside your website. This tutorial will explain how to easily delete all unnecessary comments from WordPress website.

What you’ll need

Before you begin this guide you’ll need the following:

  • Access to WordPress Admin area
  • Access to phpMyAdmin

Option 1 — Deleting WordPress comments using phpMyAdmin

Login to your hosting control panel and access phpMyAdmin. Inside phpMyadmin, select your WordPress database (see this tutorial to find out your WordPress database name) and click on SQL tab in order to run a query.

phpmyadmin

IMPORTANT: To prevent unwanted data loss, it’s strongly recommended to create backup of your MySQL database before running any queries.

Depending on what you want to achieve run the following queries:

Remove all pending comments in WordPress:

DELETE from wp_comments WHERE comment_approved =  '0'

Remove all spam comments in WordPress:

DELETE from wp_comments WHERE comment_approved = 'spam'

Remove all approved comments in WordPress:

DELETE from wp_comments WHERE comment_approved =  '1'

Remove all trash comments in WordPress:

DELETE from wp_comments WHERE comment_approved = 'trash'

Note that depending on your WordPress setup, the prefix of comments table (wp_ in this case) can be different.

Simply copy and paste the query you want to run into the SQL tab and press Go button.

WordPress Delete Pending Commends using phpMyAdmin

Option 2 — Deleting spam comments via WordPress Admin Dashboard

Login to your WordPress Admin Dashboard and navigate to Comments -> Spam section. You will be able to see Empty Spam button and by clicking it you will delete all comments on your WordPress flagged as SPAM.

phpmyadmin

Option 3 — Deleting pending comments using WordPress plugin

One of the easiest ways to delete all Pending comments is by installing WordPress plugin called Delete Pending Comments.
You can easily install this plugin by navigating to your WordPress Admin Dashboard and clicking on Plugins section. Inside Add plugins section, search for Delete Pending Comments plugin and install it. For more detailed tutorial how to install WordPress plugins click here.

Once installation of the plugin is complete access Comments -> Delete Pending Comments section. Copy and paste security phrase into the text field and press Delete Pending Comments button.

WordPress Delete Pending Comments Plugin

Conclusion

Congratulations, you have learned how to remove all unwanted comments in your WordPress blog. This can be very helpful while dealing with automated spam comments on your website.

1 Comment

Click here to post a comment

  • Hello Merkys, you have described great ways to remove the unwanted comments from the WordPress blog or website. I, however, believe that it is good to remove the plugin from WordPress default admin section. It’s really easy. Removing comments through the PHPMyAdmin is the best way but it needs some technical knowledge of MySQL. While removing the comments with the help of plugin can decrease your website speed as it needed you to install another specific plugin for a small task which can be managed from WordPress admin dashboard.

It's time to switch to a faster hosting for free.

No worries, it's one-click-easy to cancel at any time during your free trial.

  • FREE Domain Name
  • FREE Website Migration
  • 24/7 Professional Support
  • + much more

Join thousands of subscribers worldwide

and get awesome deals & the newest tutorials to your email

Please wait...

Thank you for sign up!

More in WordPress Tutorial
How to Clean up Infected WordPress Using WordFence Plugin

Close