shadow

Disable, Limit and Delete WordPress Revisions

For me a major WordPress Blog annoyance is the WordPress Revisions feature. It essentially saves a copy of your post or page every time you update it. If you share my frustration, here’s how to stop or limit WordPress Revisions and clean current revisions from your database.

Remember kids: Backup before you try this at home

WordPress is an awesome blogging platform with many useful features, but WordPress Revisions is the one feature I have never said about “oh, wow, I wish I had the previous iteration of this article“.  I back my database up regularly (and so should you), which gives me a backup of my article anyway, so for me it makes sense to disable WordPress Revisions all together.

There are various plug-ins that can handle this for you, and I recommend that you use one of them if you’re not comfortable fiddling around in code.

Otherwise, open your wp-config.php file, which resides in your WordPress root/install directory, and add either one of the following lines before the ?> at the bottom of the file.

To totally disable WordPress Revisions to prevent additional copies of posts and pages being saved, add this:

define('WP_POST_REVISIONS', FALSE);

To limit WordPress Revisions to say 1, 2 or 3 revision copies only, add this and change the number to suit your preference:

define('WP_POST_REVISIONS', 2);

The following line of code will erase all the WordPress Revisions in your blog. I did this, because I don’t want any copies anywhere – it reduced my 7.4MiB database to 3.2MiB, which just shows how much space WordPress Revisions can occupy (and this is a development database, which means it’s still relatively small).

Do you really want to delete all your WordPress Revisions?

Open you favourite MySQL interface software (commandline, PHPMyAdmin, MySQL Workbench – they all work), back up your current database and then enter the following command:

DELETE FROM wp_posts WHERE post_type = "revision";

Your database will now be wiped clean of every single WordPress Revision (but obviously not your actual article or pages). In any case, please take my my advice: back up your database.

And… you’re done!  You should now have a significantly smaller WordPress database, which will speed things up a bit – it really makes a different if your blog is huge, less so if you only have a few entries.

Happy blogging!

No Comments

Post a Comment

%d bloggers like this: