WordPress Tip: How to Limit Or Turn Off Post Revisions

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.

Be careful using this codes, I strongly recommend to just limit revisions number.

Limit revisions number

define(‘WP_POST_REVISIONS’, 5);

You can replace 5 with the number of your choice, with this code, only last 5 latest post revisions will be saved.

Disable revisions

define(‘WP_POST_REVISIONS’, false);

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

Divi 2.0 WordPress Theme

Like what you read here in this blog post? If yes, please sign up and get latest articles delivered to your email account for FREE! You’ll be also subscribed to newsletter, where I share a exclusive content and offers.

About Kris Hoja

Hi! I'm Kris. For a while I was blogging about WordPress, now I'm owner of HogStudio - Creative Agency focused on website development.
Add me on Google+ and don't forget to follow me on Twitter :)

Leave a Reply