Controlling the post revision feature in WordPress 2.6

This may seem esoteric for some but I like to be in control of the technology that I use. So, when Automattic included post revision retention to WordPress 2.6, I had my reservations about how much it would clutter my database with things that I didn’t need. Thankfully, there is a way to control the feature but you won’t find the option in the administration screens (they seem to view this as an advanced setting and so don’t want to be adding clutter to the interface for the sake of something that only a few might ever use); you have to edit wp-config.php yourself to add it. Here are the lines that can be added and the effects that they have:

Code: define(‘WP_POST_REVISIONS’,’0′);

Effect: turns off post revision retention

Code: define(‘WP_POST_REVISIONS’,’-1′);

Effect: turns it on (the default setting)

Code: define(‘WP_POST_REVISIONS’,’2′);

Effect: only retains two previous versions of a post (the number can be whatever you want so long as it’s an integer with a value more than zero).

Update (2008-07-23): There is now a plugin from Dion Hulse that does the above for you and more.

Leave a Reply