Today I'd like to share with you a very cool WordPress tip how to change post revision number, auto save interval and disable it completely.
What is a post revision?
Let me quote WordPress Codex:
The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons).
It's a very good tool to restore yours post draft when you encounter errors like browser crash, PC reboot or you lose your internet connection, when you go back to edit that post, WordPress will show a warning telling you that has a backup of your post and a link to restore the backup. It's very useful option included in all WP installations.
If you're on shared server a good thing to do is disabling or limiting number of single post revisions. It helps to get lower CPU usage and load site faster because of smaller database size. To do this simply edit your wp-config.php file in main WordPress folder at your FTP and paste one of examples listed below. Before you do any edits in wp-config.php be sure that you have a fresh backup of this file! It's a core file and a very important one. Any mistakes like no semicolon or comma in code can end up crashing whole website.
Limit revisions number
You can replace 5 with the number of your choice, with this code, only last 5 latest post revisions will be saved.
With this code you will disable post revisions at your site, but I recommend to use the first code.
Change Autosave Interval
define( ‘AUTOSAVE_INTERVAL’, 180);
This code is setting up a interval between post auto save. Note that it's in seconds, so it will save your post every 3 minutes. Of course you can change 180 to any number you want.
Let me know in comments if this tip was useful for you