How to change: WordPress autosave and post revisions

Wordpress LogoWordPress has a built in autosave feature that automatically saves when you’re editing a post. A big disadvantage is the default frequency at which it saves your posts, every minute is kinda often. So, if you use the WP editor to write your posts than you save quiet often and it might interrupt your editing.

What I usually do is to change this default value to something like every 5 minutes. You can alter the autosave behaviour by adding this define to your wp-config.php (interval is in seconds, 300 = 5min):

define('AUTOSAVE_INTERVAL', 300);

Even a higher value of 10 or 15min might make sense if you write longer posts and don’t want to end up with so many “autosaves” of your current draft…

Another feature which is pretty new is post revisions. You find them as one of the boxes below your post editor on the write panel. If these post revisions go unmanaged, they might significantly increase the size of your database.

define('WP_POST_REVISIONS', 10);

This define is telling WP to only keep 3 revisions. If you save the 4th revision, the first one is purged off.

It is also possible to disabled post revisions altogether, by using the following define:

define('WP_POST_REVISIONS', false);

Another way to solve this is to use a plugin, like:

Post Revision Control

By using this plugin you also get a very granular way to control the number of revision per post & page. Just in case if you think you need more / less revisions than your new default setting.

Hope this helps! Let us know what other useful defines you usually add to your configuration of WordPress. Thanks!

Read More