Whenever you save a page or post in WordPress it creates a revision. This occurs in both drafts and already published posts that are updated.
Post Revisions can be helpful in case you need to revert back to a previous version of your content. However, they can also hurt the performance of your WordPress site.
On large sites, this can add up very quickly to thousands of rows in your database which are not necessarily needed. And the more rows you have the larger your database in size, which takes up storage space. Follow the steps below on how to delete, limit, and disable WordPress revisions for faster performance.
To reduce post revisions, you need to go to the root of your WordPress installation using cPanel File Manager or FTP.
Limiting Post Revisions
If you want to save a couple of post revisions for every post you add to your site – just to be on the safe side. For this, the best option is to set a limit on the number of post revisions that are saved to your database. Add the following line to your wp-config.php file:
define( ‘WP_POST_REVISIONS’, 3 );
What this line does is that it saves the 3 most recent post revisions instead of all of them i.e. the older ones are automatically deleted once newer versions are saved. You can replace the number 3 with another integer depending on your preference.
Disabling/Re-enabling Post Revisions
In order to disable post revisions permanently, locate your WordPress site’s wp-config.php file that’s located in the root directory. Add the following line of code at the very top:
define( ‘WP_POST_REVISIONS’, false );
This line of code disables post revisions from being saved to your database in the future. If you’d like to enable this option sometime in the future (for whatever reason), simply replace the line with:
define( ‘WP_POST_REVISIONS’, true );
Setting the Auto-Save Interval
Instead of limiting the post revisions to a pre-defined number you can also increase the auto-save interval to save fewer revisions. To do this, open up your site’s wp-config.php file and add the following line at the top:
define( ‘AUTOSAVE_INTERVAL’, 600 );
By default, WordPress auto-saves your post revisions every minute (60 seconds) but by adding this line it’ll save them every ten minutes (600 seconds). This automatically reduces the number of post revisions that are stored to the database.
If you shy away from coding or adding code to your site’s wp-config.php file, you can always get the job done by installing a plugin. Some popular choices are WP-Sweep and WP Revisions Control.