How to use the WordPress WP_POST_REVISIONS and AUTOSAVE_INTERVAL options to disable and limit post revisions and change the auto-save interval.

WordPress Post Revisions and Auto-Save

Written by in Tutorials |

WordPress Post Revisions

WordPress Post Revisions

If you haven’t noticed, WordPress saves post and page revisions every time the Save Draft and Publish buttons are pressed as well as when the auto-save function kicks in every 60 seconds.

It’s a good thing too because I can go for hours without remembering to save, enthralled by whatever literary masterpiece I’m constructing at the time…or maybe just mesmerized by my monotonous two-finger keyboard pecking, but I digress…

WordPress Post Revisions

With so many revisions going on, you can quickly add hundreds of records to your database, especially if you’re a habitual saver and perfectionist. For most people this won’t be a problem, after all that’s what databases do — store stuff. But eventually, this can add a lot of bloat; it may even slow your website down a tad.

Let’s put those giant unwieldy database fears to rest; open up your wp-config.php file and add the following (right before the “stop editing” warning):

define('WP_POST_REVISIONS', false);

/* That's all, stop editing! Happy blogging. */

You guessed it; this will completely disable post revisions. However, you can also change the maximum number of revisions that each post and page will keep by changing false to a number, like so:

define('WP_POST_REVISIONS', 5);

WordPress Auto-Save

Sometimes it’s annoying when people are constantly doing things for you; as if you’re inept or forgetful — there’s a fine line between helpful and rude. That’s why I like to change the WordPress auto-save interval from the default 60 seconds to a more appropriate 3 minutes and 42 seconds. I do that by opening up my wp-config.php and pasting the following:

define('AUTOSAVE_INTERVAL', 222);

You’re free to change it to however many seconds make you feel like you’re in control, and the robots only work for you.

Revision Control Info and Plugins

You can find more info about revision management in the WordPress Codex, and if you don’t like playing with code and prefer the plug-and-play ease of plugins, try the following:

  • Revision Control — allows the user to set a site-global setting for pages/posts to enable/disable/limit the number of revisions for the page/post. The user may change this setting on a per-page/post basis, and delete specific revisions via the Revisions Meta box.
  • WP-Optimize — allows you to remove post revisions, comments in the spam queue, and un-approved comments. It will also clean and optimize your database tables.

Just for the record, I saved this post 19 times before publishing.

Enjoy this post? Consider sharing it: