How can you delete post revisions in WordPress blogs? Post revision is a cool way in which WordPress autosaves your posts while you type. This helps to recover posts should your browser crash, or internet crash, and you can always restore an older version of the post. But Post revisions tend to pile up in your database.
Most of times the number of post revisions is double the number of posts! No wonder the database file size is growing so fast. Every post we edit keeps accumulating post revisions. If there are frequently edited posts, the revision can be a large number.
Optimize Post Revisions
Of course you can stop post revisions by adding the following to wp-config.php (in root of your WordPress installation)
But post revisions have really helped me recover crashed posts, so I want to continue using them. So I add these to wp-config.php instead.
define( 'AUTOSAVE_INTERVAL', 120);
This saves only the latest 3 post revisions of any article (note false is replaced by 3, you can add a different value if you like), so multiple edits will not pile up these post revisions. Next I increased the autosave interval to 120 seconds (default is 60 seconds). So this lets me continue using post revision with decreased saves and only latest saves. But this does not delete my 8000+ useless post revisons over 3-4 years old, which I no longer need.
Delete Post Revisions
Download the Delete Post Revisions Plugin and it will delete all the post revision there are. This is how the admin panel of the plugin looks like. We did not click the check box as there were too many revisions. There is only 1 button and that does the job.
It take ~ 20minutes for the plugin to clean 6000 – 8000 post revisions and might need to call it several times till you get the message that no post revisions could be detected.