Table of Contents
Before I go and show your how to disable WordPress post revisions in your Blog, I like to ask you – Why you want to do this? Post revisions are one of the best features of WordPress which allow you to restore your post or page with any older version in case you accidently erase your current version. Although, I don’t recommend anyone to do what I am going to share today but if you are looking to gain some speed or performance increase for your website and want to reduce your WordPress database size, then you can always disable post revisions in your WordPress Blog.
Instead of disabling post revisions, you can also delete post revisions after some intervals, let’s say twice a month or something like that. If you want to know how to delete old wordPress revisions from database, then read this post – Delete Old WordPress Revisions From Database
Now if you have decided to disable post revision for your post and pages then perform the following steps to accomplish that –
# 1 – Locate & Open wp-config.php File
Before editing, you need to locate and open your wp-config.php file. You can locate the wp-config.php file in the root of your WordPress blog.
# 2 Add Code to wp-config.php File
Before making any changes to the wp-config.php file, backup your current file to a safe place. In case you make any mistake then you can restore your ws-config.php file with this. Once you are ready, then add the following code to ws-config.php file –
Increase Autosave Interval –
define('AUTOSAVE_INTERVAL', 300 ); // 300 is seconds(time)
The above will increase the autosave interval of your post or page to 300 seconds (5 minutes).
Limit Number of Post Revisions –
Now if you want to limit the number of post revisions then add the following code to ws-config.php file –
define( 'WP_POST_REVISIONS', 5 ); // Limited to 5 Revisions only
Disable WordPress Post Revisions –
Add below code in your wp-config.php file to disable WordPress Post Revisions. But note that, when you disable the post revisions there is still one autosave per post.
define( 'WP_POST_REVISIONS', false ); // This code will turn off WP Post Revision Feature
The above code will disable all your future Wordpress post revisions or page revisions.
But if you want to disable WordPress post revisions and also want to increase autosave interval from 60 seconds (default) to 300 seconds (5 minutes), then add this code in your ws-config.php file –
define('AUTOSAVE_INTERVAL', 300 ); // autosave increase to 5 minutes define('WP_POST_REVISIONS', false );
After adding this code, your post will be autosaving every 5 minutes instead of every minute which was WordPress default and all your future post revisions are now disabled.
Where should I add the above code in the ws-config.php file ?
Adding the above code at any location in the ws-config.php file will not give you desired outcome. You will need to make sure that you add the above code (as per your choice) only before ABSPATH, otherwise, you will not see any changes in WordPress post revision feature. In short, the code won’t work.
See below how I added the above code in my ws-config.php file. Make sure you add the code same way.
That’s it. The above code will increase the autosave interval to 5 minutes instead of 1 minute and will also limit the Post Revision to only 5 per post or per page.
If you are also making the same setting in your WordPress blog, but at later point in time you like to delete the old WordPress Post Revisions then read “How to Delete WordPress Post Revisions From Database“
I’m sure this process will help you to increase your site speed and also help you to reduce your database size significantly. If you like this post, then please share with your friends and let them know how they can improve their site speed and get rid of post revisions which can be unnecessarily increasing their WordPress database size.
If you have any question, feel free to comment below. Also, share this useful tip with others too.
Don’t forget to LIKE Digital Harpreet Facebook Fan Page
You can also follow me on Twitter for latest updates related to WordPress, Blogging, Social Media & Marketing.