If you are like me then you are a stickler for speed. There is nothing worse than a slow website! One of the ways in which I keep my WordPress websites running fast is to disable post revisions. I never use them and some WordPress hosting companies even disable this feature to keep your database smaller and your site running fast.
Follow the directions below on how to disable WordPress post revisions (and page revisions). There is also an alternate option to limit post revisions.
Note: Revisions aren’t enabled by default on other types of posts, such as WooCommerce products or custom post types. So you don’t need to worry about them. Just the default WordPress posts and pages.
- Option 1: Disable WordPress post revisions with code
- Option 2: Disable WordPress post revisions with a plugin
Option 1: Disable WordPress post revisions with code
Step 1
First we will need to open up your wp-config.php file. This should be located in the root of your WordPress site. Please back the file up first.
Step 2
We are then going to insert the following code. You will notice I am also adding a line to change the default autosave interval from 60 seconds (1 minute) to 300 seconds (5 minutes). Note, when you disable the post revisions there is still one autosave per post.
//disable WP Post Revisions define('AUTOSAVE_INTERVAL', 300); // seconds define('WP_POST_REVISIONS', false);
This needs to be inserted above the ‘ABSPATH’ otherwise it won’t work.
See my example below.
Step 3
Save your wp-config.php file and re-upload it to your server. And your done! The revisions option next to your Publish button will no longer show.
Limit revisions
Maybe you have a client that wants revisions but you want to limit them. You can set a number of revisions. WordPress will keep that number and delete any previous ones. See the alternate code below.
define('AUTOSAVE_INTERVAL', 300); // seconds define('WP_POST_REVISIONS', 3);
The above code will save only three revisions. If you don’t set a limit you might end up with a lot of revisions over time. See this picture below from a client’s site I was working on. They had 239 revisions on just one page. The client has about 600 pages. If you do the math that could be an additional 143,400 entries in your database.
Option 2: Disable WordPress post revisions with a plugin
Your second option is to use a WordPress plugin to disable and or limit WordPress revisions. We developed the Perfmatters plugin, a lightweight WordPress performance plugin.
In the plugin, you can either disable post revisions or limit them with one click. This can be a lot easier than worrying about code.
And make sure to check out how to disable scripts on a per-page/post basis in WordPress with Perfmatters.
Summary
Hopefully, now your WordPress revisions won’t be bloating your database. And don’t forget to also delete the old ones. Check out my other post on how to delete old WordPress revisions and optimize your database.
As always feel free to comment below!
Thanks for your article! I think that, If you’re working alone with your blog it’s okey to turn revisions off completely. I think this functionality designed in mind only for team work.
Totally agree. You can easily do that with our Perfmatters plugin. https://woorkup.com/go/perfmatters-plugin There is an option to disable revisions, limit them, and delete old existing ones.
define(‘WP_POST_REVISIONS’, false); will always store revisions in database (check it with phpmyadmin), so the trick is useless.
This is from the official WordPress documentation: https://wordpress.org/support/article/revisions/ It still saves the one autosave per post but will disable the revisions. I’ve used this on hundreds of sites and can confirm it works fine.
best guide on the internet, that ABSPATH thing is important.
Great free value.Best to you!
Thanks George. Glad it was helpful!
Helpful?
Life savior, hate those darns revisions.
Excellent, I disable it surely.
hi, thanks for your trick.
will it work for woocommerce products too?
best regards
Francesco
Hey Francesco,
By default WooCommerce products don’t support revisions, so you don’t have to worry about them.
Great tip! I am choosing the config edit than the plugin. Aside from disabling revisions, is there other wp hacks to increase speed without using CDN’s?
I would check out our post on how to speed up WordPress: https://woorkup.com/speed-up-wordpress/
Hi Brian! I have used this trick to turn off revisions. Don’t like them. Clutters my db. Now, I see that the revisions have disappeared from the backend but what about the db? Does WP actually delete them the moment I add the code in wp-config? My site has been running for a year already so I have previous revisions. My gut tells me the old revisions are still there but new ones are not stored… could you enlighten me?
Hey Koen,
You are correct in your assumption. You still need to delete them from your database. Check out my other post: https://woorkup.com/delete-old-wordpress-revisions-db/ Once you delete them, since you already have the “limits” in place, you are good to go going forward :)
Great tips Brian, thank you!
After taking a db backup, which one do you recommend starting with – disable/limit or delete them? Does it matter?
Hi Jan! After taking a backup. I recommend deleting them, and then starting fresh with a limit of 3 revisions. This way they won’t bog down your database, but you’ll still have a couple in case you need to revert to an older copy of a post. I’ve used this same method for 5+ years and I write pretty much 24×7.
Really? Deleting revisions to speed up Wordpress? I would argue that if deleting revisions in WordPress speeds up your website, then your database is malfunctioning – and you should really get it fixed or switch hosting.
Make sure your database uses indexes properly. Having zero or 1 million revisions should not have any impact on performance – that is exactly what databases are designed to handle with ease.
I’ll add some more to this post soon Erlend. 👍 While I agree with you, it can become an issue with indexes running out of memory on large sites + a crappy host combo. And the sad thing is, a majority of the large sites out there are on budget hosts where this does become a problem. Or like you said, their database can even sometimes be misconfigured as well. This is why clearing out revisions can help and is simply just a good practice to have. But yes, the primary reason is disk space. Smaller sites probably won’t see any perf improvements.
Very clear instructions, unlike other websites that provide the instructions that are right but not clear.
Yes, I’m using Perfmatter. And it’s a must for Siteground shared host. :)
Thank you very much.
Awesome guide Brian.
Really helped me a lot.
In my case, I was clearing the Revisions using WP Rocket plugin.
Now, it’s kind of peace of mind.