Features
Database Cleanup
Database cleanup removes unnecessary data that accumulates over time — post revisions, auto-drafts, spam comments, expired transients, and orphaned metadata. A lean database means faster queries, smaller backups, and a more responsive WordPress admin.
Safety first
The plugin never deletes anything without showing you a preview first. Every cleanup operation has a "Preview" button that shows exactly what will be removed and how much space will be freed. Review the preview before running any cleanup.
The plugin only touches standard WordPress database tables. It never touches custom tables created by other plugins unless you explicitly opt in.
Available cleanup operations
Post Revisions
WordPress saves a copy of every post every time you click "Save Draft" or "Update." Over time, a single post can accumulate dozens or hundreds of revisions. This operation removes old revisions, keeping the most recent ones.
Auto Drafts
WordPress auto-saves posts as you type. If you navigate away without publishing, these auto-drafts remain in the database indefinitely. This operation removes them.
Trashed Posts
Posts in the trash are soft-deleted — they still occupy database space. This operation permanently deletes them.
Spam Comments
Comments marked as spam accumulate over time. This operation removes them permanently.
Trashed Comments
Comments in the trash. This operation permanently deletes them.
Expired Transients
Transients are temporary cached data stored in the database. Many plugins use them. Expired transients are no longer needed but remain in the database. This operation removes them.
Orphaned Metadata
When posts, terms, or users are deleted, their metadata (custom fields, term meta, user meta) sometimes remains behind. This operation finds and removes metadata that references content that no longer exists.
Optimize Tables
Reclaims unused space and defragments database tables. Similar to running OPTIMIZE TABLE directly. Works with InnoDB and MyISAM storage engines.
Scheduling
Each cleanup operation can be scheduled to run automatically:
- Never: Manual cleanup only
- Daily: Runs once per day
- Weekly: Runs once per week
- Monthly: Runs once per month
Scheduled cleanups run during low-traffic periods using WordPress cron. You'll receive an admin notice after each scheduled cleanup completes.
WP-CLI
Database cleanup has no WP-CLI subcommand. Every operation runs from the Database tab, always with the preview first; scheduled cleanups (Pro) run through WordPress cron. The wp cachingout command set is purge, preload, settings, cdn, audit, assets and version.
Kill switch
Add this to wp-config.php to disable all database cleanup functionality:
define( 'CACHINGOUT_DISABLE_DATABASE', true );
Troubleshooting
The cleanup preview shows 0 items. This is normal — it means there's nothing to clean. Some sites accumulate data faster than others depending on publishing frequency and plugin usage.
Cleanup is taking a long time. Large sites with years of accumulated data may take several minutes. The operation runs in the background and won't block your admin session.
I accidentally deleted something I needed. Database cleanup is permanent. Always review the preview before running. Consider taking a database backup before your first cleanup.