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.
No comments yet.

Leave a Reply

We're really pleased you want to comment. As a reward we'll include a link to one of your own blog posts. Write your comment as normal, then we'll display your recent blog posts for you to choose from. Un-check the box to opt out.