How to turn off or limit WordPress revisions!

How to turn off or limit WordPress revisions!

If you use WordPress for your blog I’m sure that you have noticed that each time you press the “Save Draft” or “Publish” button a new revision of your post is saved in the database.

WordPress saves all past revisions of your posts which you can access through the “Past Revisions” region within the “Edit Post” form. These revisions however waste space in your database and just makes it slower to respond.

So how do you limit these automatically saved revisions to a minimum number or turn off this functionality completely? This is easily done by a little tweaking of your wp-config.php file.

Just add the following statement to completely switch off post revisions

define(’WP_POST_REVISIONS’, false);

You can always set this value back to ‘true’ to re-enable revisions.

Alternatively, if you only need to limit the number of revisions just to save up some database space, you can use a positive integer to indicate the maximum number of revisions WordPress should save.

define(’WP_POST_REVISIONS’, 5);

The above statement will create a maximum of 5 revisions per post, and an additional one for the auto-save function. Older revisions will be deleted automatically when a new one is created.

The same functionality can also be achieved by the use of a plugin like the ones found here but I think it is always better to keep your WordPress installation clean by using as fewer plugins as possible.

Posted by

Nikos is a Web Developer and Consultant and has put many years of work on web technologies. His interests lie in the Content Management, eCommerce and Web Publishing area. He's been involved in the development of numerous big sites and projects back in his home country, Greece, and in the design and implementation of several Web applications.

Nikos has written 44 awesome articles.

Leave a Reply