WordPress saves a copy of a post every time you click update, forever, unless told otherwise. On an older site this quietly grows into tens of thousands of rows inwp_postsandwp_postmeta, bloating every query that touches those tables. The fix is to delete old revisions and cap how many WordPress keeps in the future.
What causes this?
Revisions are a safety feature with no default limit. A page edited 400 times carries 400 copies of itself. Editors that autosave aggressively multiply this. The rows sit in the same tables as your live content, so they slow the queries behind every page, feed, and search.
How to check
Run this to count revisions:
SELECT COUNT(\*) FROM wp\_posts WHERE post\_type = 'revision';
And their weight, including orphaned meta:
SELECT ROUND(SUM(LENGTH(post\_content))/1048576, 1) AS mb
FROM wp\_posts WHERE post\_type = 'revision';
< 1,000Revisions. Ignore it.
1,000–10,000Worth cleaning.
\> 10,000A real problem. Fix it.
How to fix it manually
Back up your database first. Deleted revisions cannot be restored without a backup.
- Take a full database backup
wp db export.
- Delete revisions with WP-CLI
wp post delete $(wp post list --post_type='revision' --format=ids) --force or the SQL equivalent that also removes their postmeta.
- Cap future revisions in wp-config.php
define('WP_POST_REVISIONS', 5);
- Optimize the tables afterward
wp db optimize.
- Re-count to confirm
How BoltAudit does it
The audit runs all of the above for you and turns it into one reviewed action.
1Finds it automatically. The Database report counts revisions and their megabytes ("38.2 MB across wp\_posts and wp\_postmeta").
2Preview the exact change. How many rows, which tables.
3Automatic backup, then clean in one click.
4Roll back any time from the restore point.
Common questions
Will I lose the ability to undo edits?
You keep the most recent revisions per the cap. Old history from years ago goes.
Is 5 a good cap?
For most sites yes. Heavy editorial teams sometimes prefer 10.
Does this speed up the front end?
Indirectly but measurably on bloated sites: smaller tables mean faster queries everywhere.
What about autosaves and trash?
Autosaves are separate single rows and harmless. Emptying old trash helps too and is part of the cleanup.
Run BoltAudit on your site
Free plugin · 1 site · 3 audits per month · no credit card.