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

WordPress revisions, know how to undo changes; Whenever you save a draft or update a published WordPress page or post, a content management

Updated on July 25, 2022
WordPress Revisions: How To Undo Changes & Go Back to an Earlier Version of Posts and Pages

WordPress revisions, know how to undo changes; Whenever you save a draft or update a published WordPress page or post, a content management system (CMS) automatically creates revisions. When enabled, this feature prevents you from missing out on important work. So, unfortunately, over time, WordPress revisions can take up unnecessary disk space and affect your site’s performance.

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

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

Fortunately, you can use methods to minimize the negative effects these stored revisions have on your site. For example, in addition to excluding, deactivating, or limiting them, you can also optimize your revisions database.

This guide will introduce WordPress revisions and explain where to find them. We will then guide you on using revisions and prevent them from negatively affecting your site.

Let’s start!

WordPress revisions

So, WordPress revisions automatically record changes you make to pages or posts on your site. So, a new copy of a page is created every 60 seconds by default, like when you click the Save Draft, Publish, or Update buttons.

WordPress reviews are useful for any website owner. They serve as backups that you can restore in an unexpected outage, such as accidentally closing your browser tab or experiencing a power outage.

They also allow you to revert to older versions of your content. For example, you might find that a post isn’t performing as well as it used to, and you want to revert some recent changes.

Revisions are also very useful when you have a team working on your site’s content. In addition to letting you see what made post/page edits and what edits were made, WordPress’s revisions feature also records the username and timestamp of those changes. This increases transparency and facilitates collaboration in editorial work.

Problems with WordPress revisions

WordPress revisions can become a serious problem if you don’t manage them properly. So, the more pages and posts you add to your site and will generate the more comments.

If you have a large site or make changes frequently, this can quickly lead to unnecessary database bloat. This is 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 will take up. Unfortunately, this can slow down your site and lead to longer load times, hurting your site’s user experience and search engine optimization (SEO).

So therefore, it is critical to learn how to control revisions in WordPress in your favor. So, whether you want to delete revisions entirely, disable or limit them, or optimize your revisions database, you have many options.

Where to find revisions in WordPress

Before discussing the different ways to use and change revision settings in WordPress, it is important to first understand where to find them. In the editor screen of your post or page, go to the menu on the right and click on the Document tab.

So, if revisions are enabled and changes have been made, you will see the number of revisions 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 see all saved edits and compare any two revisions side by side. You will see two columns: the left shows the previous version of the post or page, and the right shows the selected version.

Don’t forget to save the file.

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

How to disable WordPress revisions

On the other hand, you can completely disable WordPress revisions. You can also leave this feature enabled to limit or exclude revisions to minimize the space occupied by the database. So, the next section describes how to do this.

However, if you don’t find any purpose or use for this feature, you can disable it completely. To do this, use the same method we discussed above, editing your site’s wp-config.php file. The only difference is that the value must be set from false to true.

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

Desible post revision

So, select the post types you want to disable revisions and save your changes. That’s it!

How to Optimize the Revision Database in WordPress

So, the longer you run your website, the more revisions you may have stored in your database. But, of course, if you spend years updating and editing content, you’ll accumulate a lot of revisions.

Use the slider to navigate through the various restore points. This system highlights content that has been added (plus and green) or removed (minus and red and green).

So, if you want to keep the existing version and return to the editor screen without making any changes, just click the article title at the top of the screen or the “Return to Editor” link.

So, how to revert to an older revision in WordPress

And sometimes you may want to undo changes made in WordPress. When that happens, how does WordPress makes it quick and easy?

By default, WordPress updates as a sequential post or page. So however, if you want to view or compare non-sequential changes, you can select the Compare any: two changes option at the top of the screen.

The option to switch to WordPress

So, then select the version you want to compare with. Then, whenever you’re done viewing and comparing more, you can restore a version by clicking Restore this version.

Reverting to an old revision in WordPress.

You click the button next to the review to automatically match the version you are comparing against – that review screen in the column.

How to activate WordPress

Normally, WordPress tasks are enabled by default. However, make your hosting provider or process used to install WordPress; this feature may be disabled. It is also that you or someone else on your team has activated it.

If you want to enable the control in WordPress, you can undo changes WordPress manually enable it by editing the wpconfig.php file at the root of your website and can do this via the Secure File Transfer Protocol (SFTP) client. If your host uses cPanel instead of the Kinsta user, you can use the file manager tool.

After locating and opening the file, look for the following line of code:

define(‘WP_POST_REVISIONS’, false);

Change the false value to true.

If there is no line like this, it goes above, saying “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

Disable revisions and save your changes. That’s it!

How to Optimize the Revision Database in WordPress

So, the longer you run your website, the more revisions you may have stored in your database. But, of course, if you spend years updating and editing content, you’ll accumulate a lot of revisions.

So, for example, if you have an older site, it’s not uncommon to have 100+ revisions on older or frequently updated pages. Let’s say you have 800 pages and posts on your site. If each has 100 revisions, that equates to over 80,000 entries in your database. It is a common problem in WooCommerce stores as well.

This buildup can happen quickly and occurs behind the scenes. Fortunately, in addition to completely disabling revisions, you can use a few methods to optimize your WordPress revisions. These include:

How to undo changes and remove revisions from old posts in WordPress

So, this section describes two methods you can use to permanently delete old post revisions from your WordPress site database. If you are familiar with (and are familiar with) SQL queries, you can use the first method. However, if you prefer to use a plugin, use the second method.

Method 1: Use code to delete post revisions

Clearing post revisions from your database are one of the things you should be able to do without installing a plugin (though there are plugins, which we’ll cover next). So, after all, you’re trying to save space, and installing plugins often goes against it.

To delete all previous revisions from your site’s database, log in to the cPanel of your WordPress web hosting account and click the phpMyAdmin icon.

In the left navigation, find and click on your WordPress database. Next, click on the SQL tab:

phpMyadmin

And will take you to the SQL interface of phpMyAdmin next, where you can run a SQL query. For example, you can do this by typing the following code snippet:

DELETE FROM wp_posts WHERE post_type = “review”;

So, be sure to replace wp_ with your own WordPress database prefix. Then click on the Go button. This will start the command:

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

This SQL query deletes all posts with post_type=”revision” from your database. Therefore, you should back up your database as an extra safety measure before running this query. We believe that it is best to create a database backup before making any major changes to the database.

Method 2: Delete old post revisions using a WordPress plugin

While it is possible to undo changes and delete post revisions from your WordPress site by running a single SQL query, you may find installing the plugin easier and letting it do all the work. This may be because the plugin provides additional benefits (database maintenance, removal of unnecessary files, etc.) or simply because you are not familiar with programming.

Whatever the reason, you can use a variety of plugins to delete old post revisions. Something you might consider is WP-Optimize.

So, although this plugin offers a premium version with advanced features, you can download it for free and use it to remove older versions. WP-Optimize is a complete plugin that allows you to optimize your WordPress database. You can use it not only for removing revisions but also for important maintenance tasks such as image compression and caching.

And so once the plugin is installed and activated, it will add a WP-Optimize menu item to your WordPress dashboard. So, for example, you can navigate to WP-Optimize > Database to delete post revisions.

Under Optimization, you can check the box next to Remove all post revisions and click the Run Optimization button:

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

So, you can delete the plugin or disable it when you are done with this process. And then, you don’t have to worry about taking up unnecessary space in your WordPress database.

Wrapping it up

Post revisions do not slow down your site or threaten user experience (UX). However, they start to take up a lot of space in your website’s database. Fortunately, limiting or removing revisions to old posts will free up a significant amount of space in your database.

So, as we discussed in this post, there are two methods you can use to disable, limit or remove revisions of old posts from your WordPress site:

  • First, manually delete and disable post revisions from your site’s code.
  • Installing plugins like WP Revisions Control and WP-Optimize.

And also, we hope this article will help you learn how to make changes and change site updates in WordPress Post Major. You might also want to see our beginner’s guide on managing your editorial workflow in WordPress.