Chris Farrell Membership
Work from No Home
JustHost
This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies. Find out more.

How to Turn Off Post Revisions and Autosave in WordPress

 Posted by  Add comments
 

Turn Off Post Revisions and Autosave in WordPress

Turn Off Post Revisions

How To Turn Off Post Revisions And Autosave In WordPress

For those who didn’t know, WordPress has a “Post Revisions” feature that automatically stores various versions of your posts in the database. This is a useful feature if you accidentally erase the content of a post, you can restore an older version. Similarly, if you have multiple authors on your blog you can role-back from undesired edits of the posts.

But, have you ever found the save post revisions feature in WordPress helpful? Although it can save you many hours should you accidentally delete a chunk of text or accidentally click the back button in your browser, on the whole, most WordPress users do not use this feature.

  • Do you find, “There is an autosave of this page that is more recent than the version below. View the autosave”, annoying?

Unfortunate Post Revisions Effects

Unfortunately the save post revisions feature does have a few unwanted side-effects. Database entries are created for every revision, even if they are not used. These entries don’t really impact your server’s performance, but they can expand your database massively.

  • Example: Let’s say you have 1000 posts, and in the process of making those posts you make 10 changes. Suddenly you have 11,000 entries in the database (post + ten revisions).

Now after every editing session you could run a clean-up SQL such as;

Delete from wp_posts where post_type='revision';

but lets face it, who is really going to do that?

  • I wouldn’t recommend doing this unless you are quite familiar with MySQL and databases. There are database cleaning plugins which can be used for this purpose.

In the remainder of this quick tutorial, I’m going to show you how you can turn off post revisions and change the revisions autosave interval.

 

Disable/Turn Off Post Revisions

If you don’t use post revisions on your website, you can turn them off by placing this code in your wp-config.php file:

define( 'WP_POST_REVISIONS', FALSE );

Limiting Post Revisions and Autosave Interval

If you would rather limit the number of post revisions that appear in your post editor rather than disable them, you can stipulate the number of revisions to keep along with an increased auto-save interval (the default is 60 seconds).

Just add this code to your wp-config.php file instead:

define('WP_POST_REVISIONS', 3);
define('AUTOSAVE_INTERVAL', 600); // 10 minutes should be enough!

This code will limit post revisions to three and increase the autosave interval to ten minutes. This is especially helpful for users who use post revisions, but don’t want to keep dozens of revisions for posts that receive many edits.

My Rant

Personally, whilst I think WordPress is the greatest, I don’t like the post revision feature. It’s not an issue of whether I have enough space or not in the database for those extra entries. I simply do not need them and hate the thought of possibly thousands of redundant data entries clogging up my database. Those entries will do nothing but sit in the database collecting dust (as it were). Now that’s not a very good use of resources is it?

Okay, some sites like wiki and other large organisations who use WP as a full-fledged CMS with many editors will love the feature, but the majority of WP users have a simple blog and do not need the post revision feature.

Personally, I think an option to turn off post revisions using the user interface (with the default being off) would be great. That way users can configure their system as they require.

Another nice feature would be a user definable pruning mechanism, so that revisions over X days old are automatically removed (i.e., revisions over 28 days old automatically removed).


KingSolutions.org.uk is hosted on JustHost

 Leave a Reply

(required)

(required)

85 queries in 0.781 seconds (Child).