How to disable and limit WordPress post revisions

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

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

Large number of revisions
Large number of revisions

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.

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.


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!

author bio
Brian Jackson

I craft actionable content and develop performance-driven WordPress plugins. Connect on X, subscribe to my newsletter (once a month), or buy me coffee.

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

  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?

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

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

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


Leave a Comment