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…

Using WP-POLLS for my WordPress Polls and Surveys

Using WP-POLLS for my WordPress Polls and Surveys

Back in 2010 we started using the WP-POLLS plugin to add polls and surveys to one of our WordPress sites. 9 years on, is this still the best solution? Here’s our 2019 view on using polls and survey plugins in WordPress.

The importance of images in blog posts

The importance of images in blog posts

Website visitors really do respond more to content in posts that contain great images. Learn how to use images in your blog posts, and how to optimise them.

Share This

Please share if you've liked reading this

Share this post with your friends! It really helps us, and lets us know which content visitors like best - so we can write more like that!