Reducing the number of WordPress Revisions

There are plenty of options available if you want to limit the number of WordPress revisions stored on your website. Here are a few suggestions.
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…

How do canonical links work in wordpress?

How do canonical links work in wordpress?

Canonical links are used to indicate the preferred URL of a webpage that has multiple versions or duplicates of the same content. This article explains canonical links in depth.

Share This
Martin Jarvis

Martin Jarvis

I typically reply within an hour

We're here Monday - Friday during UK working hours. Drop us an email and we'll get back to you.

Martin Jarvis
Hi. It's Martin here. How can I help you?
Start Chat with:
chat