Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Blogging & content · Guide

How to Delete All Comments in WordPress (Step by Step)

How to Delete All Comments in WordPress (Step by Step)

Short answer

Back up your database, then go to Comments, tick the select-all checkbox and choose Move to Trash from Bulk actions. Repeat for each page, then open the Trash tab and click Empty Trash. For thousands of comments, WP-CLI or a cleanup plugin is much faster.

Key takeaways

  • Back up the database before deleting anything.
  • Trashed comments stay for 30 days unless you empty the trash.
  • Raise items per page in Screen Options to delete more at once.
  • WP-CLI deletes thousands of comments in one command.
  • SQL deletion must also reset post comment counts.
  • WooCommerce reviews are stored as comments too.

How do you delete all comments in WordPress?

Open Comments, select all comments with the top checkbox, choose Move to Trash from Bulk actions, repeat for every page, then open the Trash tab and click Empty Trash.

That built-in method works well for a few hundred comments. For thousands, it is faster to use WP-CLI, a cleanup plugin or a database query.

Deleting comments is permanent once the trash is emptied. Take a backup first, even if you are sure you want them gone.

This guide covers each method, from the dashboard to the database, and finishes with how to stop new comments arriving. If you only want to hide comments, our guide on turning off comments may be all you need.

Why would you delete every comment?

People clear all comments when a site is buried in spam, when a demo or imported site carries test comments, or when they are closing comments for good and want a clean start.

Spam is the most common reason. A site with no protection can collect thousands of junk comments in a few months, and they slow down the Comments screen.

Imported content is another. Demo content from a theme, or posts moved from another platform, can bring along comments you never wanted.

Some owners simply decide comments are not worth moderating. Old comments with broken links or outdated advice can also make a page look neglected.

Before deleting everything, think about whether some comments add value. Thoughtful questions and answers can help future readers and show the page is active. If only part of the comments are a problem, filtering and deleting selectively is the better path.

Which method should you use?

Use the Comments screen for small numbers, a cleanup plugin for spam and trash, WP-CLI if you have command line access, and SQL only if you are comfortable with databases.

MethodBest forSkill needed
Comments screen bulk actionsUp to a few hundred commentsNone
Empty Spam and Empty Trash buttonsClearing spam or trashed commentsNone
Cleanup pluginSpam, trash and unapproved comments in bulkLow
WP-CLIThousands of comments, quicklyCommand line
phpMyAdmin SQLVery large sites, last resortDatabase

Step 1: Why should you back up before deleting comments?

A backup lets you restore comments if you delete the wrong ones, and permanent deletion cannot be undone from the dashboard.

Comments live in two database tables, one for the comments and one for their metadata. A database backup covers both.

Our guide on backing up a WordPress database shows several ways to do it, including plugins and phpMyAdmin.

Download the backup to your computer rather than leaving it only on the server.

If your host offers one-click restore points, create one as well. It is the quickest way back if anything goes wrong, and it covers files as well as the database. Note the time of the backup so you know exactly which version you would be restoring.

Step 2: How do you delete comments from the Comments screen?

Go to Comments, tick the checkbox at the top of the list to select the page, choose Move to Trash under Bulk actions, click Apply, and repeat until the list is empty.

  1. Go to Comments in the dashboard.
  2. Click All at the top to show every status.
  3. Tick the checkbox in the table header to select every comment on the page.
  4. Open Bulk actions, choose Move to Trash and click Apply.
  5. Repeat until no comments remain.

The Comments screen documentation explains each tab and bulk action.

To handle more per page, open Screen Options at the top right and raise the number of items per page. Very large values can make the screen slow or time out, so increase it in steps.

Step 3: How do you empty spam and trash permanently?

Click the Spam tab and use Empty Spam, then click the Trash tab and use Empty Trash, which permanently deletes everything in those lists.

Trashed comments are not gone yet. WordPress keeps them in the trash, and by default empties it automatically after 30 days.

Emptying it right away frees up database space and removes the comments for good.

You can change the automatic trash period with the EMPTY_TRASH_DAYS constant in wp-config.php, but most sites can leave it alone. The default gives you a month to notice a mistake.

If you have a lot of spam, clear it first. Spam comments often outnumber real ones by a wide margin. Our guide on stopping comment spam helps prevent the pile from coming back.

Step 4: How do you delete all comments with WP-CLI?

Run a WP-CLI command that lists every comment ID and passes them to the delete command with the force flag, which removes them permanently.

WP-CLI is the fastest method for large sites. Many hosts include it over SSH.

wp db export before-comments.sql
wp comment delete $(wp comment list --format=ids) --force

The first line saves a database backup. The second deletes every comment, skipping the trash because of --force.

To delete only spam, add --status=spam to the list command. The wp comment delete reference lists the options, and the WP-CLI site explains how to install the tool.

On a very large site, the list of IDs can be too long for one command. In that case, delete in batches by status or by post.

How do you delete comments with a plugin?

Install a database cleanup plugin such as WP-Optimize and use its options to remove spam, trashed and unapproved comments in one click.

WP-Optimize includes cleanup options for spam and trashed comments, along with other database tidying.

Some plugins are built only for deleting comments in bulk. Search the plugin directory, check recent updates and reviews, and deactivate the plugin when you are done.

Plugins usually focus on spam and trash rather than approved comments. To delete approved comments too, trash them on the Comments screen first, then let the plugin empty the trash.

Our guide on optimizing the WordPress database covers what else these cleanup tools remove.

How do you delete all comments with SQL?

In phpMyAdmin, run DELETE queries on the comments and comment meta tables, then reset each post's comment count to zero.

Use this only if the other methods fail and you have a fresh backup. A typo in SQL can damage your site.

DELETE FROM wp_comments;
DELETE FROM wp_commentmeta;
UPDATE wp_posts SET comment_count = 0;

Replace wp_ with your table prefix, which you can find in the wp-config.php file. The phpMyAdmin documentation explains how to run queries.

The last line matters. Without it, posts can still show old comment counts in your theme.

WooCommerce product reviews are stored as comments too. These queries delete them as well, so be careful on a store.

How do you stop new comments after deleting them?

Turn off comments for future posts in Settings, then Discussion, and close comments on existing posts with bulk edit or a plugin.

Untick Allow people to submit comments on new posts under Settings, then Discussion. This only affects new posts.

For existing posts, go to Posts, select all, choose Edit from Bulk actions, and set Comments to Do not allow.

Our full guide on turning off comments covers pages, media and plugins that disable comments everywhere.

What if you want to keep some comments?

Filter the Comments screen by status, post or search term, and delete only the matching comments instead of clearing everything.

Use the tabs to pick pending, approved, spam or trash. The search box finds comments containing a word, name or email address.

You can also open a single post's comments from the post list and clear only those.

Another option is to leave old comments in place but close new ones on older posts. Under Settings, then Discussion, you can automatically close comments on articles older than a set number of days. This keeps useful past discussion while stopping fresh spam on old pages.

For ongoing control, our guide on moderating comments explains approval settings, blocklists and notifications.

Frequently asked questions

Can I undo deleting comments?

Comments moved to the trash can be restored from the Trash tab until it is emptied. Once you empty the trash or delete with WP-CLI using the force flag, they are gone. The only way back is restoring a database backup.

Why do old comment counts still show after deleting?

Each post stores its own comment count. Deleting through the dashboard or WP-CLI updates it, but deleting directly in the database does not. Run a query to reset the counts, or use a plugin that recalculates them.

Will deleting comments affect SEO?

Removing spam and low-quality comments usually helps or has no effect. Useful comments can add relevant text to a page, so deleting many good comments might slightly change how a page reads. For most sites the impact is small.

How do I delete only spam comments?

Open Comments, click the Spam tab and use the Empty Spam button. With WP-CLI, list comments with the spam status and pass their IDs to the delete command. Cleanup plugins also have a one-click spam removal option.

Does deleting all comments delete WooCommerce reviews?

It can. WooCommerce stores product reviews as comments, so bulk deletion on the Comments screen, WP-CLI or SQL may remove them. Filter out product reviews or back up first if you want to keep them.

Sources

  1. Comments Screen WordPress.org Documentation
  2. wp comment delete WordPress Developer Resources
  3. WP-CLI WP-CLI
  4. WP-Optimize WordPress.org Plugins
  5. phpMyAdmin Documentation phpMyAdmin

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.