A handy feature of WordPress is that it keeps revisions of your blog posts and pages, giving you the option to revise your current post to a previous version. WordPress stores a version of the article you are writing into a “revision” each time you do a preview. So lets say you’ve previewed your document 7 times which means you end up having 8 records (7 revisions and the final article) stored into your WordPress database. Now lets assume you have a WordPress page that is 2 years old, every week you write two articles this ends up to 1664 records in your database of which 208 are actually used this means that 1456 records are just sitting on your database doing “nothing” besides slowing down things.
You can do two things to fix the huge amount in the database by either limiting the number of revisions stored in the database or do not store any revisions at all.
Before you continue, please make a backup of your WordPress website. Make sure you make a database backup as well as as backup of your files.
Limit WordPress Revisions
Using the steps below I’ll show you how you can limit the number of revisions that WordPress will store per page or post. By default there is no limit on the amount of revisions so any limit you impose is going to help keep your WordPress database more efficient. We’ll be setting up the WP_POST_REVISIONS setting in your wp-config.php file to accomplish this.
In the example below I am going to set the WordPress revisions to 3 revisions, this means that for each article you’ll have maximum 4 database entries. If you feel confident enough that you do not need to use that many revisions you can reduce the number of revisions to 2 or even 1 or as the next section will explain, disable the WordPress revisions.
- Login into your cPanel.
- Access the cPanel File Manager Code Editor and navigate to your wp-config.php file.
- Enter in the following code towards the top of the wp-config.php file:
define('WP_POST_REVISIONS', 3);
- After that click on the Save Changes button to apply the changes to the wp-config.php.
Disable WordPress Revisions
In the next steps I’ll show you how you can completely turn off WordPress revisions for your pages and posts. Like before I’ll be using the WP_POST_REVISIONS setting in your wp-config.php file to make these changes.
- Login into your cPanel.
- Access the cPanel File Manager Code Editor and navigate to your wp-config.php file.
- Enter in the following code towards the top of the wp-config.php file:
define('WP_POST_REVISIONS', false);
- After that click on the Save Changes button to apply the changes to the wp-config.php.
Cleaning Up Old Revisions
The previous mentioned methods only apply on future posts and articles. To clean up your database of previous written articles and posts I recommend the following free WordPress plugin: Better Delete Revision. You can find the plugin within the WordPress installer. If you want to download the plugin and upload it manually you can do so from: https://wordpress.org/plugins/better-delete-revision/
The advantage of this plugin is that it removes and delete old revisions of posts, pages and related meta content completely and optimise the database by reducing the size and additional do some other database optimisation to speed up your WordPress website.