I actually like Post Revisions. I write my blog posts directly in WordPress and sometimes I realize that what I wrote previously is actually better than my current draft. When this happens I’m glad to have post revisions.
But WordPress revisions have a negative side. They created clutter in your WP database. A cluttered database will slow down your website.
Once I’ve set the post live I don’t need all the past versions. It would be nice if WordPress had a “publish and delete revisions” button. But until it does, here are the solutions I’ve found that do exist. Remember to Backup your database before trying any of these options.
** UPDATE: You can skip down to Option 2: The Easy Way to clean up your WordPress site. **If you've been blogging for awhile your WordPress database may be turning into a monster!Click To Tweet
Option 1: The hard way:
Remove all Post Revisions
Edit wp_config.php to turn off post revisions
Open your wp_config.php file and add the following code to turn off revisions.
Delete existing post revisions in your MySQL WordPress database
Be sure to backup your database first before performing any queries in phpMyAdmin. Login to your phpMyAdmin and select the appropriate database then run this query.
Note: If your table prefix is not “wp” (default), replace wp in the code below with the prefix that you defined.
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'
All revisions will be gone.
Option 2: The Easy Way
Revision Control Plugin
If you aren’t comfortable editing your wp_config.php file or diving into the MySQL database, use the Revision Control Plugin. This plugin will allow you to adjust the number of revisions and delete existing revisions that you no longer want.
I wish I had found the WP-Sweep plugin when I first wrote this post! This will do more than just clean up post revisions. This plugin will clean up all the mess….
Simply add this plugin then go to Tools → Sweep and run sweep.
No more Monster!