How to delete revisions in WordPress by Bas Wijdenes

Let’s start getting those WP revisions under control.

There are two things you can do to get the revisions under control.


Let’s keep the revisions under control first.

So, we can set a maximum number of revisions per page. You can do this in your functions.php file.

I don’t want to go into it too much, but if you don’t know how to create a child theme with a functions.php file in WordPress, I want to refer you to this page.

To set up a revision cap you need the following command snippet.

define( 'WP_POST_REVISIONS', 3 );

You can adjust the 3 to another number.
Here are some more options that you can use.

  • true (default), -1: store every revision
  • false, 0: do not store any revisions (except the one autosave per post)
  • (int) > 0: store that many revisions (+1 autosave) per post. Old revisions are automatically deleted.

For more options I’d like to refer you to this page.


The ‘Better Delete Revision’ plugin.

Unfortunately, WordPress has no option to remove the old revisions, and my knowledge of WordPress does not go far enough to implement this. I use a plugin called Better Delete Revision for this. The plugin is made by Galerio.

The plugin can also be found under this name at Plugins.

After installing the plugin you will see it at Settings> Better Delete Revision

Better delete revisions
Better delete revisions plugin.

The plugin works exactly as it describes, there is only an option to check the Revisions and then remove them.

betterdeleteversionmanager
Better delete revisions plugin.

As you can see I have already removed 747 revisions.

If you use both options, your WordPress website will remain clean from archived data.


Why would I you set a maximum to your Revisions, though?

I noticed that my blog started to slow down more and more, couldn’t really think of anything until I started to re-new the homepage lay-out.

I was updating the front-page after every small change I did just to see how it looked. The revisions got well above the 100 before I started to think that couldn’t be a good thing, right?

I started to Google this and found out that revisions indeed slow down your website.

Your database gets a lot more data since it has to remind every single change you’ve made to posts.

I know, I know updating each time you changed something isn’t good. You should save them as drafts.


Summary

I have reviewed this blog post and I no longer think that the content is very relevant, but because this post has been popular and some may still want to keep their WordPress Revisions under control, I keep the blog post for now.

The original post dates from 20 August 2015.


Banner image credits.

Banner Image by simplu27 from Pixabay.

Published by

Bas Wijdenes

My name is Bas Wijdenes and I work as a PowerShell Automation Engineer @ Wortell.

Leave a Reply

Your email address will not be published. Required fields are marked *