Mr Speaker

Revisions in WordPress 2.7

blog revisionsQuick note for those running WordPress 2.7, and are starting to freak out about the 500 gazillion revision rows that are now getting inserted into your database... There are a few ways to cull them - such as deleting all posts with type "revision", but that's pretty annoying. Thankfully, the WordPress docs now have a rough draft up on revision management which outlines some "hidden options".

The nicest is the WP_POST_REVISIONS setting you can add to your wp-config.php file. It accepts the following values:

  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except the one autosave per post)
  • (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.

So you can turn them off entirely by setting WP_POST_REVISIONS to false. I like to keep it enabled (it is useful when you just realised you did something stupid) but limit it to, say, 10 rows per post. Just open up wp-config.php in your text editor and add the line:
define('WP_POST_REVISIONS', 10);
The next time you save a post, all the old revisions (besides the last 10) will be automatically deleted and your database will breathe a sigh of relief.

You can add the definition anywhere in the config file, but I put mine just before the comment: /* That's all, stop editing! Happy blogging. */

That's all, stop editing! Happy blogging.

Captcha! Please type 'radical' here: *
How did you find this thingo? *