Disable WordPress Revisions – Limit WP Revisions

Disable WordPress Revisions – Limit WP Revisions
Disable WordPress Revisions – Limit WP Revisions

Learn how to disable or limit WordPress revisions to improve performance and save database space. This guide provides easy steps to modify your wp-config.php file for better WordPress optimization.

Every time you save a post, WordPress quietly stashes a full copy as a revision. That’s the safety net that lets you undo a bad edit. But on a busy site those copies pile up in the database, and after a few hundred posts you’re carrying thousands of rows you’ll never look at again.

You can control that with one line in wp-config.php. Here’s how to disable revisions entirely or, better for most people, cap them at a sane number.

Step 1: Open your wp-config.php file

It lives in the root of your WordPress install. Reach it over FTP/SFTP, your host’s file manager, or cPanel. Back up the file before you touch it, and add your change above the line that reads /* That's all, stop editing! */ so it takes effect before WordPress loads.

Step 2: Disable WordPress revisions

To stop WordPress saving any new revisions at all, add this:

// Disable WordPress Revisions
define( 'WP_POST_REVISIONS', false );

Honest warning: this throws away your undo button. If you paste over a paragraph and hit save, the old version is gone. We don’t recommend disabling revisions outright unless you have another versioning workflow in place.

Step 3: Limit the number of revisions instead

The better middle ground for most sites is to keep a few and drop the rest. Set the constant to a whole number:

// Limit WordPress Post Revisions - recommended settings ( minimum: 2 | maximum: 5 )
define( 'WP_POST_REVISIONS', 3 );

Now WordPress keeps the three most recent revisions per post and prunes older ones as you save. A value between 2 and 5 keeps a real undo history without letting the table balloon.

One thing this won’t do

Changing the constant only affects revisions going forward. Revisions already sitting in your database stay there. To clear those out you need to delete them separately, either with a query against the wp_posts table or a WP-CLI command like wp post delete targeting the revision post type. Take a full database backup first.

That’s the whole job: one constant decides whether WordPress hoards every draft or keeps a tidy few.

Next: PHP 8 create_function Replacement

7 thoughts on “Disable WordPress Revisions – Limit WP Revisions”

  1. Fantastic blog you have here but I was curious if you knew
    of any discussion boards that cover the same topics discussed here?
    I’d really love to be a part of group where I
    can get advice from other knowledgeable individuals that share the same interest.
    If you have any suggestions, please let me know. Cheers!

  2. I think that what you typed made a ton of sense. However, what about this?
    suppose you added a little information? I mean, I don’t wish to tell you how to run your website, but what if
    you added something that grabbed folk’s attention?
    You ought to glance at Yahoo’s front page and see
    how they create post titles to grab people to open the links.
    You might try adding a video or a picture or two to get
    readers interested about what you’ve written. Just my opinion, it might bring your blog a little bit more
    interesting.

  3. Hi! Would you mind if I share your blog with my facebook group?
    There’s a lot of people that I think would really enjoy your content.
    Please let me know. Thanks

Leave a Comment

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


Scroll to Top