How to Use WordPress Revisions to Recover from Mistakes
Running a website isn’t always easy. The more content you publish, the more likely it becomes that you’ll make a mistake now and then. When that happens, you shouldn’t have to start from scratch. Ideally, there would be a way to revise your content without it affecting the rest of your site.
If you’re using WordPress, its native revisions feature enables you to do just that. You can take any of your posts or pages, and use revisions to return them to an earlier state. That way, you can undo mistakes in a matter of seconds and get back to work promptly.
In this article, we’ll show you how WordPress revisions work. Then we’ll go over two ways you can improve WordPress’ built-in revision system to make your life easier. Let’s get to work!
An Introduction to WordPress Revisions
The way WordPress revisions work is simple. As you update a post or draft, WordPress stores old versions of the content in your database. You can access those versions from the editor, by clicking on the Browse button next to Revisions in the right-hand sidebar:
Once you open the revisions page, you’ll see a side-by-side comparison of the page or post’s latest versions:
If you want to go back even further, there are options at the top of the screen that enable you to jump to older versions of the content:
At any point, you can choose to restore any version of your post and page by clicking on the Restore This Revision button at the top of the screen. If you have multiple users working on a single post, WordPress will also let you know which version belongs to whom, making it easier to merge your work.
As you might imagine, WordPress doesn’t store an unlimited number of revisions. How many versions it keeps will depend on how you configure the feature (we’ll talk more about this shortly).
The Content Management System (CMS) also keeps one autosave of your content, which it generates automatically from time to time. That way, if you run into an issue with your website’s connection, you won’t lose that much progress even if you forgot to save your draft.
WordPress also enables you to disable revisions altogether. This can make sense if you’re not running a content-heavy website. For example, if your site consists of a single landing page, enabling revisions might not be worth your time. For a blog or ecommerce store, however (just to give two examples), revisions can be a lifesaver.
2 Tips to Get the Most Out of WordPress’ Revision System
The default WordPress revisions system works well enough. Just as with every other aspect of this CMS, though, it’s most effective with a little customization. Let’s talk about two ways you can tweak the way it works.
1. Limit (or Increase) the Number of Post Revisions WordPress Stores
The number of revisions WordPress saves by default will vary depending on your installation. However, it’s usually between five and ten versions of a single post. At any point, you can change the number of revisions WordPress stores if you feel you need more or fewer or them.
There are two ways you can do that. The first involves accessing your website via File Transfer Protocol (FTP) and navigating to your website’s root folder, where you can find your wp-config.php file:
That core file contains some of your site’s key settings, so you need to be careful if you’re going to edit it. To change the number of revisions WordPress stores, access the file from your FTP client and add the following line of code at the end:
define( ‘WP_POST_REVISIONS’, X );
Go ahead and replace the ‘X’ in that code with the number of revisions you want WordPress to store. Then save the changes to the file, and close your FTP client.
If you don’t want to mess around with code, you can achieve the same effect by using the WP Revisions Control plugin. After installing and enabling the plugin, you can jump to your Settings > Writing screen.
Inside, you’ll find a new section called WP Revisions Control, where you can set the number of versions you want the CMS to store:
Remember to save the changes to your settings, and you’re good to go.
2. Delete Old Post Revisions
Depending on how many revisions you configure WordPress to save, they might bloat your database a bit. If you want to squeeze every last bit of performance from your site, it can be a good idea to do some cleanup from time to time.
By cleanup, we mean deleting all the data your website doesn’t need. Doing this manually can be a chore, since you need to be 100% sure what each file and table in your database contains. A far better solution is to use a plugin such as WP-Optimize:
We like WP-Optimize because it’s a Swiss Army knife for WordPress optimization. It can clean up your database, optimize your images, and enable caching for your pages. For now, though, let’s focus on its cleaning capabilities.
Once you install and enable the plugin, a new WP-Optimize tab will show up in your dashboard. If you click on it, it will show you all the optimizations the plugin can run:
As you can see, there’s a dedicated option for post revisions. Before you run it, however, you’ll want to make sure you won’t need access to any of those revisions anymore. After all, the plugin will delete them permanently.
Once you’re confident, click on the Run all selected optimizations button, and you’re done. Doing a quick cleanup from time to time like this is a great way to keep your website running smoothly.
Conclusion
The more complex your WordPress website becomes, the more likely it is that you’ll make small mistakes within your content now and then. Editing that content can be a delicate process, so having backups or revisions you can return to is often a lifesaver.
By using WordPress’ revision system, you can return your content to earlier versions and compare the differences between each iteration. That makes it easy to spot and correct mistakes, so nothing slips by you.
Image credit: Pixabay.