Reducing the number of WordPress Revisions

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 in to 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 recommend if you’re not confident with mysql) or you can use a plugin such as this Delete WordPress Revisions plugin.

Categories: Wordpress

2 Responses to “Reducing the number of WordPress Revisions”

  1. Ratan Mia says:

    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.

    • 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.

Leave a Reply

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!