This article is all about managing WordPress post revisions: what they are, how to disable, limit and delete them, why you should, and multiple ways to do all of the above. I’ve included quick links below so you can jump directly to the section that applies to you. But first, here’s a quick piece of advice when considering which option (code vs. plugin) is best for you.
- If you’re a beginner with zero coding knowledge, a plugin is probably best.
- If you have some coding experience, or have a developer who can help, you might prefer to use your own code (edit your
wp-config.php
file) - If you aren’t already using a performance plugin, I highly recommend you consider Perfmatters + WP Rocket, which will satisfy all your post revision needs and boost your performance in many other ways.
In this article…
- What are WordPress revisions?
- How revisions negatively affect WordPress performance
- What I use & recommend
- The Ultimate Combo = WP Rocket + Perfmatters
- Disable WordPress revisions: with code • free plugin • premium solution
- Limit WordPress revisions: with code • with a plugin
- Delete WordPress revisions: one time • schedule deletion
What are WordPress post revisions?
When you’re working on a piece of content in WordPress, whether it be a post, page or custom post type, WordPress keeps track of the changes you make.
LEARN: What’s the difference between a post & a page?
Each time you click the Save Draft or the Update button, WordPress saves a copy of your content at that time. Each copy is called a revision. You can view all of your revisions directly from the post/page you’re editing.
- Find the Publish meta box in the top-right corner of the post edit screen
- Click the Browse link to view all revisions
From there, you can revert back to a previous revision if you need to recover any of your content that you’ve since deleted or changed.
How revisions negatively affect WordPress performance
Just like your published posts & pages, revisions are stored in your WordPress database. Each revision adds a new record to your database. If you have 100 posts, and each post has 5 revisions, that’s 500 additional records in your database.
When someone visits your site, they only see 1 record in your database, and that’s the one for the published post. They don’t care about all the revisions. The revisions are only for you internally, if you need them.
Each time a visitor hits a page on your site, your server queries the database to find the relevant information to display to the visitor. The more records you have in your database, the longer that query can take. The longer it takes, the slower your website becomes.
What I use & recommend
Because I’m a big fan of transparency, I want to show you exactly what I’m using on this site (and all sites I build), and share my recommendations based on experience.
What I Use
I personally DO NOT like to completely disable post revisions. Although I have rarely needed to restore a revision, I can see a few instances where it could potentially save me from a lot of trouble.
- I often revisit old content to make fairly substantial updates. It’s nice to have one or two copies of the previous version.
- Some posts take multiple days (weeks even) to write. I might want to jump back to something I wrote previously, but have since erased.
- I’m sure you’ve heard it a million times, but “It’s always good to have a backup.”
I limit post revisions to 4
I couldn’t decide between 3 or 5, so I went with 4 🤷🏼♂️. It’s just enough that I have a few versions to fall back on if I need to, but not too many that it will slow down my site, or clog my database.
And because I’m comfortable editing my wp-config.php
file, I use code to limit revisions on my entire site, for all post types.
I use WP Rocket to improve WordPress performance
WP Rocket provides an option to delete all post revisions from your WordPress database. This is helpful if you need to retroactively delete revisions, but it won’t prevent them from being stored in the future (see “The Ultimate Combination” below for a way to do both).
Deleting old post revisions is nice, but I love WP Rocket for all the other performance benefits it provides. See below for a brief rundown of its best features.
The Ultimate Combination 🚀
I truly believe the ultimate WordPress performance plugin would be a combination of WP Rocket & Perfmatters. They have a little bit of overlap, but most of their features are unique, and incredibly useful on their own.
Both plugins deal with WordPress post revisions, but in different ways. Let me briefly explain how they each deal with revisions, and show you how they offer so much more in terms of performance.
Perfmatters
In terms of WordPress revisions, Perfmatters provides an easy way to:
- completely disable post revisions
- limit revisions to 1, 2, 3, 4, 5, 10, 15, 20, 25 or 30 per post
Other Performance Benefits of Perfmatters
Perfmatters is a premium plugin, but it’s incredibly affordable for a low, yearly price. And it not only makes it easy to disable or limit post revisions, but it provides a bunch of additional performance enhancements that are guaranteed to speed up your site.
- Disable scripts on per page/post basis
- Disable embeds, emojis, jQuery migrate and a bunch of other scripts that slow down your site
- Enable DNS prefetching & Preconnect
- Remove unnecessary info from the
<head>
section - Optimize WooCommerce by removing unused features & scripts
- Check out our comprehensive review »
WP Rocket
When it comes to WordPress revisions, WP Rocket makes it easy to delete all existing post revisions. You can also remove any auto drafts, as well as trashed/deleted posts. If you’ve been running your site for a while with revisions enabled, they make it simple to remove everything and start with a clean slate.
To keep them disabled (or limit them) moving forward, you should either update your wp-config.php
file or use the Perfmatters plugin.
Other Performance Benefits of WP Rocket
WP Rocket is hands-down the best WordPress caching solution money can buy (What’s caching?). There are some free caching plugins that do an OK job, but none are as easy to set up, as good at what they do, or integrate so well with other hosting platforms & plugins as WP Rocket does.
- Complete WordPress caching solution
- Compatible with most popular WordPress hosts, Cloudflare, third-party CDNs and many other WordPress plugins.
- Database optimization
- Automatic ecommerce integration with WooCommerce, Easy Digital Downloads and other shopping cart plugins
- Lazyloading, CDN support, preloading, defer JavaScript, critical path CSS, minification, concatenation, and so much more.
- See a full list of features »
Now, if you’re already using a different WordPress performance plugin, and just simply need to adjust your WordPress post revisions…
How to disable WordPress revisions
There are several ways to disable post revisions in WordPress. Which method you choose will depend on how much control you want over your revisions, as well as your technical expertise. Jump to the section that applies to you.
- Disable all revisions for your entire site (using code)
- Disable revisions only for certain post types (free plugin)
- Disable revisions + other performance benefits (premium plugin)
Disable revisions in wp-config.php file (using code)
Add the following line of code to your site’s wp-config.php
file:
// Disable Post Revisions
define( 'WP_POST_REVISIONS', false );
This code must be placed above the line that says, “That’s all, stop editing!”.
Here’s an example:
Disable revisions for certain post types (free plugin)
If you want to disable WordPress revisions for only certain post types…
- Install & activate the Disable Post Revision WordPress plugin
- Navigate to Settings > Writing
- Under “Writing Settings,” look for Disable Post Revisions
- Hold down the control/cmd key and select the post types that you’d like to disable revisions for
- Scroll to the bottom and click Save Changes
Disable revisions + performance benefits (premium plugin)
If you’d like to disable WordPress revisions & receive a bunch of additional performance benefits from the Perfmatters plugin…
- Purchase & install the Perfmatters plugin
- Navigate to Settings > perfmatters
- Look for Limit Post Revisions
- Choose Disable Post Revisions
- Click Save Changes at the bottom
How to limit WordPress revisions
The simple, free way to limit WordPress post revisions is by editing your wp-config.php
file. However, if you are not comfortable editing this file, you can use an inexpensive premium plugin to do the job.
Limit revisions in wp-config.php file (free, using code)
Add the following line of code to your site’s wp-config.php
file. You can change the 4 to any number you’d like. I recommend no more than 5 to keep your site running fast.
// Limit Post Revisions
define( 'WP_POST_REVISIONS', 4 );
This code must be placed above the line that says, “That’s all, stop editing!”.
Here’s an example:
Limit revisions + performance benefits (premium plugin)
Again, the Perfmatters plugin gives you a bunch of options for limiting your post revisions (1, 2, 3, 4, 5, 10, 15, 20, 25 or 30 revisions).
Follow the instructions above and choose a limit instead of disabling them.
How to delete WordPress revisions
Reminder: All of the above solutions to disable or limit your revisions only work from this point forward. They will not retroactively delete old revisions. But I’ll show you how to do that right now.
You’ve got a few options (click link to jump to a section):
- Free Plugin (free, one-time deletion)
- Premium Plugin (schedule deletion, plus additional performance benefits) (recommended)
- MySQL query (highly technical, not recommended unless you are a developer)
Delete WordPress revisions with a free plugin
The best free plugin to delete WordPress revisions is the Bulk Delete plugin by Sudar. It has great reviews, is actively maintained, and Sudar is a seasoned developer.
- Install & activate the Bulk Delete plugin
- Navigate to Bulk WP > Bulk Delete Posts
- Scroll down until you see the By Post Revision section
- Check the box for All Revisions
- Click Bulk Delete
This action cannot be undone, so make sure you have a recent backup, and you are OK losing all of your revisions.
Delete revisions with a premium plugin
My preferred method of handling old post revisions is with the WP Rocket plugin. I already have it installed for the many performance benefits it provides, and it also includes a really simple way to delete old revisions.
You can even schedule WP Rocket to automatically delete revisions (and optimize your entire database) on a daily, weekly or monthly basis. I have my database automatically optimized once a week.
- Navigate to Settings > WP Rocket
- Click on the Database tab
- Choose what you’d like to delete & optimize
- (optional) At the bottom, choose a schedule frequency
- Click the Optimize button
Delete revisions in your database with a MySQL query
I was planning on including a MySQL query you could run on your database to delete all post revisions, but…
- there seems to be conflicting information on which method is the best one
- it’s dangerous to edit your database directly in this way
- if you have a highly customized site/database, the code might not work for you
- there are quality plugin solutions that can do it
For those reasons, I highly recommend using Bulk Delete (free), WP-Optimize (free) or WP Rocket (premium) to delete WordPress revisions from your site.
That covers just about every possible method for managing your WordPress post revisions. As you can tell, there is no single solution that’s best for everyone. I tried to provide options for various scenarios, so please take your site’s current setup into consideration when choosing how to best disable/limit your revisions.
And as always, if you have any questions, please ask them in the comments.
We Recommend
https://kinsta.com › wordpress-hosting
Fast and secure infrastructure, worldwide CDN, edge caching, 35 data centers, and enterprise-level features included in all plans. Free site migrations.
https://gravityforms.com › features
Create custom web forms to capture leads, collect payments, automate your workflows, and build your business online. All without ever leaving WordPress.
Leave a Comment