The Ultimate Guide to WordPress Revisions
Many of us spend a lot of time working on our content. We spend hours making sure the spelling, grammar, punctuation are as good as possible.
So we are worried about losing content. What happens if my browser crashes? What happens if someone edits my post and makes a mistake?
Fortunately, WordPress has the solution: Revisions.
The Revisions feature in WordPress can help you sleep peacefully at night.
When you write in WordPress, your changes will be automatically saved. You can easily restore any previous version of your content. And if you want to compare your current version of a post to an old version, WordPress gives you an easy side-by-side comparison.
This guide is a comprehensive introduction to Revisions in WordPress. Here's an overview of everything we'll cover:
All about revisions
- Video introduction to revisions
- How to find revisions in WordPress
- How to restore previous revisions
- How to preview old revisions
- How to delete old revisions
- Help! Not all my content is saved in revisions
- How to use AutoSave with Revisions
- How to limit the number of saved revisions
- How to enable or disable revisions
- Help! I can't see the Revisions area
- How to restore part of a revision
- How permissions work for Revisions
- Revisions in the WordPress Database
- Summary of revisions
Video introduction to revisions
How to find revisions in WordPress
When you're editing a WordPress post, you will see a “Revisions” link in the right sidebar. It will normally be directly under the main “Status & visibility” area:
If you're using the old Classic Editor, this link will look a little different:
Whatever editor you're using, this next screen will look the same. The screenshot below shows the revision comparison screen in WordPress. The old content on the left is marked in red and the new content on the right is in green. Please note that WordPress shows the full code of your posts. This is done for accuracy, but sometimes means that this revision screen is not very easy to read.
By default, WordPress will show you a comparison of the two most recent versions. However, you can compare any revisions.
Check the box “Compare any two revisions” and you can navigate through all your revisions using the slider on the top of the page.
You can also use the “Previous” and “Next” buttons to navigate through the revisions:
How to restore previous revisions
If you decide you want to replace your current post with an old version, here's what to do:
- Make sure the “Compare any two revisions” box is unchecked.
- Using the slider, browse to the revision you want to restore.
- You will see a blue “Restore This Revision” button. Click this button.
You will now be taken back to the post editing screen. That's it. The process is finished. This can be a little confusing because there is no success message. However, you don't need to click “Update”, save your post or make any other changes. Simply clicking “Restore This Revision” is enough to publish the old version.
How to preview old revisions
We've just shown you how to restore previous versions. However, WordPress doesn't offer a way to see what those revisions look like before you approve them.
To see what old revisions look like, install the PublishPress Revisions plugin. When you are looking at revisions for a post, you will now see a “Preview/Restore” link.
This will take you to the front of your site where you can see your revision. There will be a bar across the top of the page saying, “This is a Past Revision”. You will have three choices:
- Compare: see how this revision compares to the current version.
- View Published Post: see the current version live on your site.
- Restore: replace the current version with this older revision.
How to delete old revisions
WordPress does not provide an easy way to delete old revisions. One solution is to the use the PublishPress Revisions plugin.
When you are looking at revisions for a post, PublishPress Revisions will add a “Manage” link at the top of the screen.
On this screen, you can browse through all the revisions for this post. You can click “Delete” to remove single revisions, or you can use the “Bulk Actions” feature to delete many revisions at once. There are also plugins to help you automatically delete old revisions.
Help! Not all my content is saved in revisions
Not all plugins support the revisions feature in WordPress.
Some plugins such as WooCommerce will actively avoid using revisions. As a result, if you make changes to a WooCommerce product, you will not see the “Revisions” area.
If you find that not all your data is stored in revisions, then the solution will depend on the plugin you're using. Some plugins may have code snippets available to improve their support for revisions. Some plugins such as WooCommerce and Advanced Custom Fields are also supported by the PublishPress Revisions plugins.
How to use AutoSave with Revisions
Revisions in WordPress are connected to another very useful feature called autosaves. These autosaves are here to help you avoid losing your content if your browser crashes or you lose your Wifi connection.
When you are editing a post, WordPress will save a copy of your content every 60 seconds. This copy will update every 60 seconds – you can only have one autosave at a time.
If your browser crashes, or your internet fails, go back to your post editing screen. You'll see a message: “The backup of this post in your browser is different than the version below.”
If you click the “Restore this backup” button, WordPress will restore the autosave.
Sometimes the message may be slightly different: “There is an autosave of this post that is more recent than the version below.”
If you click the “View the autosave” link, you will be taken to the revision comparison screen. The autosave is labelled “Autosave” and marked in red. This helps it stand out from other revisions.
If you want more details, click here for a complete guide to autosaves.
How to limit the number of saved revisions
Some WordPress users don't like having too many revisions on their site as they believe it can cause site slowness. If you want fewer revisions stored on your site, it is possible to set a limit. You can add code to your wp-config.php file to define a limit. If you add this line to wp-config.php, WordPress will only save the most recent ten revisions for each post.
define( 'WP_POST_REVISIONS', 10 );
How to enable or disable revisions
It is possible to completely disable revisions for your site. Add this code to your wp-config.php file:
define( 'WP_POST_REVISIONS', false );
- True: WordPress revisions are enabled and every revision is stored.
- False: WordPress revisions are disabled. No revisions are stored, the autosave feature will still work.
Help! I can't see the Revisions area
Here are some possible solutions if you don't see “Revisions” in the right sidebar of your posts:
- Some popular hosts such as WPEngine do disable revisions. Check that your host does allow revisions.
- Check your wp-config.php file for the “false” code we show above.
- Are you using a page-builder plugin or theme? Some large page-builders do hide the Revisions area.
How to restore part of a revision
Unfortunately, revisions can't be restored piece-by-piece. The best way to restore part of a revision is to manually copy parts of revisions into your current post. You can highlight the part of the revision you want to recover, and then copy-paste that text into your post.
Because revisions show you the HTML text, you may need to take a couple of extra steps. You can either use an HTML block in Gutenberg, or you can click the “More tools & options” icon and use the “Code editor”:
How permissions work for Revisions
- Administrators and Editors can see all post revisions.
- Authors can see revisions for their posts.
- Contributors can see revisions for their posts in the Draft status.
By default, revisions have the same permissions as the content. This means that someone on your site who can publish a post will have the ability to update that post.
Revisions in the WordPress Database
Finally in this guide, let's take a look at the more technical side of revisions.
Every revision adds a new row in the wp_posts table. Here are some of the differences between a row for posts and a row for revisions:
- The post_status column
- The post_name column
- The post_type column
The image above also shows the post_name column. The post_name column is normally the title of the post. However, for revisions, the format is different:
- [post ID of original post]_revision_v1
In the image above, the ID of the original post is 1.
The image below shows the post_type column. Normally this shows the post type (post, page or a custom post type). For revisions, the column is set to revision.
Summary of revisions
Revisions are an awesome feature of WordPress and I can't imagine building a site without them. I've created 26 revisions so far while working on this post.
If you have any questions about revisions, let me know in the comments. I'll update the post and create more revisions!