Database Cleanup
Clean up post revisions, trash, spam comments, expired transients, and orphaned metadata on a schedule.
Last updated Feb 21, 2026
Overview
Over time, WordPress databases accumulate post revisions, trashed content, spam comments, expired transients, and orphaned metadata. This bloat increases database size, slows queries, and makes backups larger than they need to be. BoostPro's database cleanup tools help you remove this unneeded data safely.
These settings are located on the BoostPro → Cleanup tab, under the Database section.
Cleanup categories
Post revisions
WordPress saves a new revision every time you update a post or page. On active sites, this can result in dozens of revisions per post. BoostPro lets you clean up old revisions while keeping a configurable number of recent ones (default: 5 per post).
On MySQL 8.0+ and MariaDB 10.2+, BoostPro uses window functions for efficient bulk deletion. On older database versions, it falls back to a loop-based approach.
Trashed posts
Posts and pages in the WordPress trash are not automatically deleted. This category permanently removes all trashed posts and their associated metadata.
Spam comments
Spam comments flagged by Akismet or other anti-spam tools remain in the database until manually emptied. This category permanently deletes all comments marked as spam.
Expired transients
WordPress transients are temporary cached values stored in the database with an expiration time. Once expired, they serve no purpose but remain in the options table. This category removes all expired transients.
Orphaned metadata
When posts or terms are deleted, their associated metadata (post meta and term meta) can be left behind. This category finds and removes metadata entries that reference deleted posts or terms.
Manual cleanup
You can run any cleanup category individually from the Cleanup tab. Before running, BoostPro displays a count of items that will be cleaned for each category, so you know exactly what will be removed.
Important
Database cleanup permanently deletes data. Make sure you have a recent backup before running cleanup for the first time.
Scheduled cleanup
For hands-off maintenance, enable scheduled cleanup to run automatically via WordPress cron:
- Toggle:
db_scheduled_cleanup(default: off) - Frequency: daily, weekly (recommended), or monthly
- Cron hook:
boost_db_cleanup
The Cleanup tab displays the timestamp of the last scheduled cleanup and the number of items removed.
Revision limit
In addition to cleaning existing revisions, you can set a limit on how many revisions are kept per post during cleanup:
- Toggle:
db_revisions_limit(default: off) - Revisions to keep: configurable number (default: 5)
This setting applies during cleanup operations. It does not prevent WordPress from creating new revisions as you edit content. During each cleanup run, any revisions beyond the configured limit are removed, keeping only the most recent ones.
Tip
Weekly scheduled cleanup with 5 revisions kept is a good balance for most sites. It prevents bloat without losing useful revision history.