Disable Post Revisions in WordPress and Reduce Database Size
Disable Post Revisions in WordPress
Today we will discuss how can we disable post revisions in WordPress or limit the revisions post to certain number. This will save lots to database space if you are editing or adding large number of posts in your website on regular basis.
Disable WordPress revisions
By default there is no limit for WordPress post revisions. It saves the revisions whenever you edit any post. This can cause high database size issue.
If you do not wish to auto save any post and disable post revisions completely in WordPress, you can add following line in your wp-config.php file:
Make sure that you save your wp-config.php file after adding above line. This will disable post revisions for your WordPress.
Limit WordPress revisions
If you do not wish to disable the post revisions completely but you would like to retain last few post revisions, you can do it using wp-config.php file. You need to add following code in your wp-config.php to limit the revision interval and number of revisions:
define('AUTOSAVE_INTERVAL', 300); // seconds define('WP_POST_REVISIONS', 3);
Above code will limit the post revisions to 3. You can adjust the interval and number of revisions as per your need.
The above steps are built-in functionality available in WordPress. If you do not wish to touch the code and you want to disable or limit post revisions, you can also use the third party plugins as well. There are plugins available to manage the post revisions as well however we have never used such plugins hence you may need to search the plugin which can help you to manage your post revisions.