Black Friday - Cyber Monday Sale
30% OFF All Premium Licenses
  • 00 Days
  • 00 Hrs
  • 00 Mins
  • 00 Secs
Use code
SIGMA30

This 30% discount applies only to the first year. From the second year, renewals are charged at the regular price.

What are WordPress trashed comments and how to clean them?

Younes JFR.

What are trashed comments?

When you delete a comment in WordPress, it isn’t removed immediately. Instead, it’s moved to the trash so you can restore it later if needed. Over time, these trashed comments can accumulate in your database, especially on websites with active discussions or heavy spam activity.

How they affect your database?

Trashed comments are stored in the wp_comments table with the status trash. Although they don’t appear publicly, they still occupy space in your database and slightly increase the size of backups or exports. Leaving a large number of trashed comments can make comment-related queries slower over time.

How to clean them?

1. Using Advanced Database Cleaner plugin

You can easily delete trashed comments using the General Cleanup module in Advanced Database Cleaner plugin.

This method is safe, flexible, and fully automated. You can customize the cleanup to:

  • Delete all trashed comments or keep only those newer than a certain number of days.
  • Use the Keep Last feature to retain a limited number of items if needed.
  • Schedule automatic cleanups so trashed comments are removed regularly without manual work.

2. Using a raw SQL query

If you prefer to clean manually, you can run this SQL query in phpMyAdmin for example:

DELETE FROM wp_comments WHERE comment_approved = 'trash';

In multisite installations, this query must be executed per subsite, replacing wp_ with the subsite prefix (for example, wp_2_, wp_3_, etc.).

Note:
While you can manually run these SQL commands to clean trashed comments, we strongly recommend using the Advanced Database Cleaner plugin.
It uses WordPress’s internal cleaning methods, automatically handles multisite installations, and ensures that all related data is safely removed while keeping your database consistent and stable.