In this post we will discuss about,
How to disable the WordPress default Autosave and revisions functions and optimize your website website to run smoothly and have a clean and organized database ?
If you are using WordPress for writing your posts then you would have probably noticed that if you leave the posting screen and come back later to edit the post, you might see a notice on the top of your screen informing you that there is an Autosave that is newer than the saved copy. This is an useful, at the same time not so appreciated function of WordPress Autosave.
By default when you install WordPress, the Autosave functons are set for saving a copy of the post you are writing very 60 seconds. This means you could end up with a lot of copies of your posts. The longer it takes you to write the post in WordPress, the more copies you will have stored in the database. So inorder keep the database clean and organized for the smooth runnig of your website, we need to disable this option. To do that, go to your wordpress installation base folder and find the file ‘default-constants.php‘ located at ‘wp-includes/default-constants.php‘.
Search for the code:
define( 'AUTOSAVE_INTERVAL', 60 );
and change it to
define( 'AUTOSAVE_INTERVAL', 9999999 );
By changing that we are actually increasing the autosave interval to a very large value and thereby disabling the Autosave.
Similarly Revisions posts also consumes the database. To Disable Revisions, find the following code:
and change it to
That’s it now you can keep the post editing window open as long as you want and without the fear of ending up with autosave posts.