Database cleanup — old revisions, trash and expired transients
Cleanup clears WordPress database bloat — trims old post revisions down to a set number, removes auto-drafts and trash older than a chosen number of days, and clears expired transients. Before you run anything, the screen shows a live preview of how many records will actually be affected.
Key features
- Trims post revisions down to a configurable number kept per post
- Removes auto-drafts and trashed posts/comments older than a chosen number of days
- Clears expired transients — WordPress’s own temporary cache entries that often outlive their expiration
- A live preview count of qualifying records for each cleanup type, shown before you click the button
- Deletion always goes through proper WordPress functions (wp_delete_post_revision, etc.), never a raw SQL DELETE
- That means attached postmeta/commentmeta is cleaned up correctly too, nothing is left orphaned
How it works
The settings screen first runs read-only queries that just count how many revisions, auto-drafts, trash items and expired transients currently qualify under the configured settings — the actual deletion only runs after confirmation.
The deletion itself calls standard WordPress functions like wp_delete_post_revision() or wp_delete_post() instead of a direct DELETE against the tables — which means core’s own related actions fire too, and postmeta/commentmeta attached to a deleted record disappears along with it instead of being left as orphaned rows.