What are unapproved comments?
Unapproved comments are those awaiting moderation in WordPress. When visitors submit a comment, it may be held for review before being published. If not regularly moderated, these pending comments can accumulate over time, especially on busy websites.
How they affect your database?
Unapproved comments are stored in the wp_comments table with the status 0. While they don’t display publicly, they still take up space and can slightly slow down queries or increase backup sizes if left unmanaged for a long time.
How to clean them?
1. Using Advanced Database Cleaner plugin
You can easily remove unapproved comments using the General Cleanup module in Advanced Database Cleaner plugin.
This method is safe, flexible, and fully automated. You can configure the cleanup to:
- Delete all unapproved comments or keep only those created in the last X days.
- Retain a limited number of recent comments using the Keep Last feature.
- Schedule automatic cleanups for ongoing maintenance without manual work.
2. Using a raw SQL query
If you prefer to perform the cleanup manually, run this SQL command in phpMyAdmin for example:
DELETE FROM wp_comments WHERE comment_approved = '0';
In multisite installations, this query must be executed separately for each subsite, changing the table prefix wp_ to the appropriate one (for example, wp_2_, wp_3_, etc.).
Note:
While you can manually run these SQL commands to clean unapproved 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.