Reducing the number of WordPress Revisions

Wordpress saves copies of your content every time you update a page or a post, and auto-save revisions are taken while you are editing content. This can greatly increase your database size, so you might want to limit the number of revisions WordPress keeps.
19 Jul, 2011

Managing WordPress RevisionsWordPress saves copies of your content every time you update a page or a post, and auto-save revisions are taken while you are editing content too. These ‘revisions’ are then displayed towards the bottom of the page when you are viewing or editing your content and can be used to compare changes between 2 different versions, to see who made changes to your content (in a multi-author site), and to restore to a previous version of your content if you have really messed up.

This is really useful, but the overhead in your WP database can get quite high if you frequently edit posts and pages, as there is no automatic culling of revisions built into a WordPress install.

There are a few ways you can keep the number of revisions in check. The way I prefer is to edit your config.php file to include the following couple of lines…

define(‘WP_POST_REVISIONS’, 3);
define( ‘AUTOSAVE_INTERVAL’, 120);
These statements will restrict the number of revisions kept to 3 and will take auto-save copies of your post or page every 120 seconds (60 seconds is the default). You can change these two values to whatever suits your needs.
If you find you already have a huge number of revisions in your site and want to remove them, you can do this either by editing the database directly to delete them (not recommended if you’re not confident with MySQL) or you can use a plugin such as this Delete WordPress Revisions plugin.

2 Comments

  1. Ratan Mia

    I personally hate when revisions are disabled. I write for one or two blogs that have completely disabled them and it is very frustrating. Firstly, because from time to time I will lose a connection and lose all my work. And secondly, because I am unable to refer back to previous drafts. I believe a few drafts are best and you can then periodically delete old drafts that are not necessary.

    Reply
    • Martin Jarvis

      Thanks for commenting. I agree that disabling revisions isn’t a good idea, but reducing them to a reasonable number is useful. Most WordPress website owners don’t go back and clear them up, which can cause database clutter.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may also like…

Why choose WordPress – what’s the fuss?

Why choose WordPress – what’s the fuss?

We decided to become WordPress experts because we believe it to be a great, cost-effective platform for small- and medium-sized businesses. It’s packed full of functionality and a great content management system – in fact, WordPress started out as a blogging platform, but developed into much more.

Share This