icon_tweet
So all of Wikipedia, text only in English, compresses to about 3gigs... Thats a lot but also easily fits on my phone. Curious...

WordPress: Disable post revisions

Post revisions is a feature in WordPress that seems like a good idea but when left unrestrained becomes a bit superfluous and bloats the database. At most one would probably only want 1-3 revisions saved of a post. I found numerous sites detailing how to modify/disable this but most of them leave out critical information for it to actually work.

Basically you add the following code to your wp_config.php file:

define('WP_POST_REVISIONS',false);

or

define('WP_POST_REVISIONS',1);

for limiting it to 3 revisions per post.

But the missing bit of information that renders this useless is that you can’t put this code at the end of your wp_config.php file, which seemed the most logical to me. Instead it must be directly below the 'DB_COLLATE' line:

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/* Turns off the post revision system */
define('WP_POST_REVISIONS',1);

so that the line is before:

/** WordPress absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
	define('ABSPATH', dirname(__FILE__) . '/');

This then worked for me across all my sites. It also meant that a post that had more than the new amount of revisions would have them reduced after editing and saving. It is possible to remove existing post revisions by running a mySQL query.

About author: Philip Tyrer

Philip is the mastermind behind Amparose and continues to strive towards creative excellence. He specialises mainly in web design but also involves himself with audio production, animation and 3D modelling, guitar, tango and painting.

Leave a Comment


* are required