WordPress Revisions are great at times, when something goes wrong with your post you are sure that there is a saved post revision to which you can revert. The post revisions feature of WordPress is real saviour in crisis times. But at some point if you are blogging regularly these post revisions will add up in the database.
If you edit your old posts sometimes to update the content or add some more information to to just make sure the post is upto date then post revisions will pile up. It is not unusual if you have tens of post revisions in your WP database. All this adds to the bulk of the database, they may not effect the site loading as these revisions are not queried when a post is requested from the front end, that means these won’t have any effect on the front page loading. But if you wish to keep the database tidy you should control how many post revisions are saved in the database. Also you should try to delete old post revisions from your WordPress database.
Delete WordPress Old Post Revisions
If you look at the WordPress plugin directory you will get a lot of plugins that will do the job for you. I am using “Optimize Database after Deleting Revisions” plugin to do the job. As the name suggests it will delete revisions and optimizes your WordPress database.
Add the plugin from your WordPress Admin section, you can also add it manually via FTP.
Install the plugin, after installing go to plugin options.
It can delete all revisions of posts and pages. If you wish to preserve most recent revisions of posts you can specify a number, for example 2 revisions to keep.
It can delete trashed items, spam comments, unused tags, and orphan postmeta items. The optimizations can be scheduled to run once daily, or once in a week or once in a month. Daily running the script is not necessary, you can set a week or month for the optimizations to run.
Download Optimize Database after Deleting Revisions
Control Post Revisions
OK, now we got rid of the WordPress old post revisions now we can control how many post revisions to store in the database by adding a tag in the WordPress Config file.
By default WordPress saves unlimited number of post revisions, but keeping a small number of revisions is always advisable to keep a check on the growing database. There is no magic number on how many post revisions you want to keep in the database, but select a sensible number like 2 or 3 that is enough. You will always have these number of post revisions ready for you. You can also delete periodically old post revisions.
Control or limit post revisions
Add the following statement to your WordPress config file that is “wp-config.php”. It will limit the post revisions to 3, you can change the number to any number you want. Other revisions will automatically deleted.
Add the following statement to your WordPress config file that is “wp-config.php”. This will permanently switch off post revisions.
That’s it, now you have deleted unwanted post revisions and also limited the number of post revisions WordPress creates.