Featured image of post WordPress Revisions: A Guide to Reverting Changes and Restoring Previous Versions of Your Posts and Pages

WordPress Revisions: A Guide to Reverting Changes and Restoring Previous Versions of Your Posts and Pages

Knowing how to undo changes with WordPress revisions can be incredibly useful. Every time you save a draft or update a published WordPress page or post, your content management system (CMS) automatically creates revisions. When enabled, this feature prevents the loss of important work. However, over time, these saved revisions can begin to take up unnecessary disk space and may even affect your site’s performance.

WordPress Revisions: A Guide to Undoing Changes & Reverting to Earlier Versions of Posts and Pages

WordPress Revisions How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

Thankfully, there are ways to minimize the potentially negative effects these stored revisions can have on your site. Besides excluding, deactivating, or limiting revisions, you can also optimize your revision database.

This guide will introduce you to WordPress revisions and show you where to find them. We’ll also show you how to use revisions effectively and prevent them from impacting your site negatively.

Let’s get started!

Understanding WordPress Revisions

WordPress revisions automatically track and save the changes you make to pages or posts on your site. By default, a new copy of a page is created every 60 seconds, as well as when you click the Save Draft, Publish, or Update buttons.

WordPress revisions are incredibly valuable for any website owner. They act as backups that you can restore in case of unexpected events, such as accidentally closing your browser tab or experiencing a power outage.

Revisions also allow you to revert to older versions of your content. For instance, you might discover that a post isn’t performing as well as it used to, and you’d like to undo some recent changes.

Revisions are also extremely helpful when you have a team working working on your site’s content. In addition to letting you see what post/page edits were made and what changes were made, WordPress’s revisions feature also records the username and timestamp of those changes. This transparency can facilitate collaboration and simplify editorial workflows.

The Potential Problems with WordPress Revisions

WordPress revisions can become problematic if you don’t manage them properly. The more pages and posts you add to your site, the more revisions will be generated.

If you have a large site or make frequent changes, this can quickly lead to what’s known as database bloat. This occurs because every time a revision is created, an additional row is added to the WordPress database table with a value of .wp_postpost_typerevision.

The larger your database, the more storage space it requires. This can slow down your site and lead to increased page load times, which can negatively impact your site’s user experience and SEO.

Therefore, it’s crucial to learn how to effectively manage revisions in WordPress. Whether you decide to delete revisions entirely, disable or limit them, or optimize your revisions database, there are various options available.

Where to Find Revisions in WordPress

Before exploring the different ways to use and adjust revision settings in WordPress, it’s essential to understand where to find them. In your post or page editor screen, navigate to the menu on the right and click on the Document tab.

If revisions are enabled and changes have been saved, you’ll see the number of revisions listed in the Status and Visibility section.

WordPress Revisions How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

Click on it to visit the Revisions page, where you can view all saved edits and compare any two revisions side-by-side. You will notice two columns: the left column displays the older version of your post or page, and the right displays the version you have selected.

Don’t forget to save your work!

When you log back into WordPress, you should find the revisions feature turned on. To confirm it’s working correctly, open the editor for any page or post and check for the Revisions option under the Document tab.

Disabling WordPress Revisions

You always have the option to disable WordPress revisions completely. You can also choose to keep this feature enabled but limit or exclude revisions to minimize the space occupied by the database. The next section will explain how to do so.

However, if you find no use for this feature, you can disable it entirely. To do this, use the same method as discussed earlier - editing your site’s wp-config.php file. The only difference is you’ll need to change the value from false to true.

If you don’t feel comfortable editing your wp-config.php file, you can also disable revisions in WordPress by using a lightweight plugin like Disable Post Revision. Once you’ve installed and activated this tool, you can access it by navigating to Settings > Writing in your WordPress dashboard:

Desible post revision

Select the post types you want to disable revisions for and save your changes. That’s it!

Optimizing Your WordPress Revision Database

The longer you operate your website, the more revisions you’re likely to accumulate in your database. If you spend years updating and editing content, the number of stored revisions can become quite significant.

Use the slider to move between the different restore points. The system will highlight content that has been added (with a plus sign and in green) or removed (with a minus sign and in red).

If you decide to stick with the existing version and want to return to the editor screen without making any changes, simply click on the post title at the top of the screen or the “Return to Editor” link.

How to Revert to a Previous Revision in WordPress

There may be times when you need to undo changes made in WordPress. Fortunately, WordPress makes this a simple and efficient process.

By default, WordPress updates posts or pages sequentially. However, if you wish to view or compare non-sequential changes, you can select the “Compare any two revisions” option located at the top of the screen.

Choosing Your WordPress Revision

Next, select the revision you want to compare. When you’re finished viewing and comparing, you can restore a version by clicking on “Restore This Revision.”

Reverting to an older revision in WordPress is easy.

You can click the button next to the revision to automatically match the version you’re comparing it against. The revision screen will appear in the column.

How to Enable WordPress Revisions

WordPress revisions are typically enabled by default. However, depending on your hosting provider or the installation process you used for WordPress, this feature may be disabled. It’s also possible that it was manually deactivated by you or another member of your team.

If you want to enable revisions in WordPress, you can manually turn them back on by editing the wpconfig.php file located in the root directory of your WordPress installation your website. You can do this through an SFTP client. If your host uses cPanel or the Kinsta user panel, you can utilize the file manager tool instead.

Once you’ve located and opened the file, look for the following line of code:

define(‘WP_POST_REVISIONS’, false);

Change the “false” value to “true.”

If this line of code doesn’t exist, add it above the line that says, “ABSPATH” and “/* That’s all, stop editing! Happy publishing. */”:

define(‘WP_POST_REVISIONS’, true);

WordPress Revisions How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

Save your changes, and you’re all set!

Optimizing Your WordPress Revision Database

As mentioned earlier, the longer your website runs, the more revisions will likely be stored in your database. Over the years, you can accumulate a substantial number of revisions, especially if you regularly update and edit your content.

For example, it’s not unusual for older websites to have over 100 revisions for older or frequently updated pages. Let’s say your site has 800 pages and posts. If each one has 100 revisions, that would add up to over 80,000 entries in your database! It’s a common problem encountered by WooCommerce stores.

This type of database bloat can occur quickly and often goes unnoticed. Thankfully, in addition to completely disabling revisions, there are a few other methods you can use to optimize your WordPress revisions. These include:

Removing Revisions From Old Posts in WordPress

This section will describe two methods you can use to permanently delete old post revisions from your WordPress site’s database. If you’re familiar with SQL queries, you can use the first method. If you’d prefer to use a plugin, stick with the second method.

Method 1: Using Code to Delete Post Revisions

Deleting old post revisions from your database is something you should be able to do without needing to install a plugin (although plugins are available, which we’ll cover next). After all, you’re trying to save space, and installing more plugins often runs counter to that goal.

To remove all past revisions from your site’s database, log in to your web hosting account’s cPanel and click on the phpMyAdmin icon.

In the left-hand navigation menu, locate your WordPress database and click on it. Next, click on the SQL tab:

phpMyadmin

You’ll be taken to the phpMyAdmin SQL interface where you can then run an SQL query. To do so, type the following code snippet:

DELETE FROM wp_posts WHERE post_type = “revision”;

Make sure to replace wp_ with your own WordPress database prefix. Next, click on the Go button to execute the command:

WordPress Revisions How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

This SQL query will remove all posts from your database that have post_type=”revision”. It’s always wise to back up your database as an added safety measure before running this query. Creating a database backup is always recommended before making significant database changes.

Method 2: Using a WordPress Plugin to Delete Old Post Revisions

While you can delete post revisions from your WordPress site by running an SQL query, you might find it easier to install a plugin and let it handle the work for you. You might prefer this if the plugin offers additional benefits, such as database maintenance or the removal of unnecessary files. Or, you might simply be more comfortable using a plugin if you’re unfamiliar with coding.

There are various plugins you can utilize to delete your old post revisions. One option to consider is WP-Optimize.

Although it offers a premium version with advanced features, you can download the free version and use it to delete your older revisions. WP-Optimize is a comprehensive plugin that empowers you to optimize your WordPress database. Aside from deleting revisions, you can also use it for essential maintenance tasks such as compressing images and enabling caching.

Once you’ve installed and activated the plugin, it will add a “WP-Optimize” menu item to your WordPress dashboard. To delete post revisions, go to WP-Optimize > Database.

Under “Optimizations,” check the box next to “Remove all post revisions” and then click on the “Run Optimization” button:

WordPress Revisions How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

Once the process is complete, you can either delete the plugin or simply deactivate it. That’s all you need to do to prevent older revisions from taking up valuable space in your WordPress database!

Conclusion

Post revisions don’t inherently slow down your website or harm user experience. However, they can take up a significant amount of space in your website’s database over time. Fortunately, limiting or removing old post revisions can free up a significant amount of space.

As discussed in this post, there are two main methods you can use to disable, limit, or delete old post revisions from your WordPress website:

  • Manually deleting and disabling post revisions within your site’s code.
  • Installing plugins such as WP Revisions Control and WP-Optimize.

We hope this article has helped you learn how to make changes and manage site updates within WordPress. You may also want to check out our beginner’s guide on managing your editorial workflow in WordPress.

Licensed under CC BY-NC-SA 4.0