Tutorial: How to Mass Delete Comments in WordPress

How to Delete All Comments in WordPress, FixMyWP guide header image

Did you log in to your WP Dashboard only to find several hundred, if not thousands, of spam comments waiting to be deleted?

If so, here is how to delete all comments on WordPress in one go and save the time and clicks of deleting them one by one, using the following 2 guides.

Mass Delete comments using phpMyAdmin

Before you run any of these queries, take a backup of your database.

  1. Open your hosting control panel (in cPanel, look under Databases) and select phpMyAdmin
  2. In the new page that opens select your database
  3. Scroll down the page and select table wp_comments
  4. If you want to delete all comments, click Empty next to the wp_comments table in the table list, confirm and you’re done.
    For the queries below, open the SQL tab, paste the query and click Go.

    If you want to remove ALL PENDING (NON APPROVED) COMMENTS then run the following query:

    DELETE FROM wp_comments WHERE comment_approved = '0';

    If you want to remove ALL APPROVED COMMENTS then run the following query:

    DELETE FROM wp_comments WHERE comment_approved = '1';

    If you want to remove ALL TRASH COMMENTS then run the following query:

    DELETE FROM wp_comments WHERE comment_approved = 'trash';

    If you want to remove ALL SPAM COMMENTS then run the following query:

    DELETE FROM wp_comments WHERE comment_approved = 'spam';

Deleting rows this way leaves their data behind in the wp_commentmeta table. You can clean it up with this query:

				
					DELETE FROM wp_commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM wp_comments);
				
			

The comment counts shown on your posts are not updated by these queries. If you have WP-CLI, you can recount them with wp comment recount $(wp post list --format=ids).

In case your database prefix is not the default one (wp_), replace the wp_ prefix I used with yours.

Need a hand with your WordPress site? Answer four quick questions and see your flat price before you pay. Start here →

Cover of the free WordPress Cleanup Guide from LeDetailWP

Free guide from LeDetailWP

WordPress Cleanup Guide

Declutter your WordPress site, clear out what slows it down and find the free plugins that keep it running smoothly.

Get the free guide →

★★★★★
I highly recommend hiring FixMyWP to fix your website. They are very professional and my issues were resolved within a few hours.
Nico Timmermans
spyglassrockband.com

Mass Delete WordPress Comments using a plugin(or two :D)

Using phpMyAdmin for deleting comments from your WordPress site may be too complicated for some of you, so I suggest taking a look at the following WordPress plugins that will do the job nice and easy.

WPCommentCleaner
Delete Pending Comments

Both of these plugins are old and may no longer be available or maintained, so check their WordPress.org pages before you install them. You may not need a plugin at all: in Comments, open the Spam or Trash tab and click Empty Spam or Empty Trash. For pending comments, use Screen Options to show up to 999 comments per page, select them all and choose Move to Trash from the bulk actions.

If you have WP-CLI on your server, this command deletes all spam comments at once:

				
					wp comment delete $(wp comment list --status=spam --format=ids) --force
				
			

As always, feel free to comment if you need help or have a question (or even two)!

Need a hand with your WordPress site?

Answer four quick questions and see your flat price before you pay. Most fixes are done the same day or within 24 business hours.

Answer 4 quick questionsSee all prices

In this article

Need a hand with your site?

Answer four quick questions and see your flat price before you pay. Most fixes are done the same day or within 24 business hours.

Related articles