Quick tip #1: WordPress Post Revisions

The WordPress Post Revision feature is very handy indeed! However, sometimes you will end up with a very large number of revisions taking up (unnecessary) space in your database and cause problems with renaming post-, category- and tag-slugs.

Many of us uses the post-slug (“wordpress-post-revisions” in this post) and many have had a slug show up with a “-2″ in the end.

By adding a few lines of code to the functions.php file you can set the number of saved revisions, or turn the feature off if you like:

// Limit the number of saved revisions
define('WP_POST_REVISIONS', 2); // any integer

// Disable post-revisions
define('WP_POST_REVISIONS', false); // turn it off

// Set the interval between saved revisions
define('AUTOSAVE_INTERVAL', 160); // set the time in seconds

Note: By disabling revisions, you don’t delete old revisions. There are a number of ways to delete old revisions:

  1. Go to your database in phpMyAdmin, open up wp_posts and search for post_type with the name “revision” — delete them all.
  2. Use a plugin like “Better Delete Revision“.