How to Disable and Limit WordPress Post Revisions

disable and or limit wordpress revisions

WordPress Post Revisions

If you are like me than 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 many WordPress hosting companies, like WP Engine, 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

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.

wp-config.php file
wp-config.php file

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.

disable wordpress post revisions
Disable WordPress post revisions

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.

No WordPress revisions
No WordPress revisions

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 pic below on a client I was recently working with. They had 239 revisions on one page. The client has about 600 pages… if you do the math that could be an additional 143,400 entries in your database.

Large number of revisions
Large number of revisions

Option 2: Disable WordPress Post Revisions With 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.

WordPress perfmatters plugin
WordPress perfmatters 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.

Disable and or limit WordPress revisions with perfmatters
Disable and or limit WordPress revisions with perfmatters

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!

GET MORE STUFF LIKE THIS

Marketing, WordPress, Blogging Tips, SEO and Reviews, once a week.

Thank you for subscribing.

Something went wrong.

14 thoughts on “How to Disable and Limit WordPress Post Revisions

  1. 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.

  2. define(‘WP_POST_REVISIONS’, false); will always store revisions in database (check it with phpmyadmin), so the trick is useless.

  3. 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?

Leave a Comment

145 Shares
Tweet
Share
Share
Buffer