How to Manage WordPress Revisions to Optimize Site Performance

Posted on January 8, 2022 by in WordPress | 0 comments

How to Manage WordPress Revisions to Optimize Site Performance

When you save a draft or update a post, WordPress stores a copy of the changes from the previous version. This feature is helpful if you ever need to revert to a previous version of your content, but these revisions take space in your database. If you have a lot of revisions, this can take up your server storage and possibly impact your site performance over time. In this article, we’ll see how to manage WordPress revisions to optimize your site performance.

What We Mean by “WordPress Revisions”

A revision is just a saved copy of the changes to your page and post content. WordPress automatically stores a revision every 60 seconds while your browser has a post or page open. It also stores a revision every time you click to update.

You can view those revisions to see all the changes made between updates, and you can also restore them to a previous revision. This helps ensure you don’t lose too much of your work if something goes wrong, such as a computer crash or power outage. It also gives you a save point that you can restore if you change your mind on an edit. You can even revisit a different version of your content months later. They’re all stored in the WordPress database for you to see.

How to Restore Page and Post Revisions

These stored WordPress revisions make it easy to restore your pages and posts to previous versions. Let’s take a look at how to restore revisions in both the classic and Gutenberg editors.

How to Restore Post Revisions in the Classic Editor

Restore Post Revisions in the Classic Editor

In the Classic editor, the list of revisions appears at the bottom under the content editor. Simply click on a revision to see a comparison between that revision and the current content or another revision.

How to Restore Post Revisions in the Gutenberg Editor

Restore Post Revisions in the Gutenberg Editor

In the Gutenberg editor, the number of revisions is shown in a separate section in the right sidebar. Click this to open the revision screen.

Restoring a Post Revision

Restore Post Revisions in the Gutenberg Editor

Clicking a revision in either editor takes you to the same revision screen. It shows you the content for the current date and time on one side of the screen, and what’s different from the current content on the other side. The current revision displays above the content on the left. A slider and previous and next buttons at the top show the various revisions to compare them. As you can see in this example, the revision screen shows the title has changed.

Restoring a Post Revision

This revision shows the title and content have changed from one revision to the next. To restore this revision, all you have to do is click Restore This Revision in the upper right.

Where are WordPress Post Revisions Stored?

WordPress page and post revisions are great if you need them, but they also use space in your database, and that can slow down the overall performance of the site. Especially sites with large archives. Over time, the database gets larger with revisions you don’t need. This can add up to a lot of revisions in your database. Fortunately, it’s easy to manage WordPress revisions. If you’re sure you don’t need them, it’s best to clear them.

WordPress post revisions are stored within your WordPress database. You can access them in several ways.

Caution: Making changes to your database can be dangerous. Be sure you have a recent backup before making any changes.

Manage WordPress Revisions with phpMyAdmin

Accessing Post Revisions with phpMyAdmin

You can delete your revisions using SQL. If you have access to your cPanel in your web host’s dashboard, select phpMyAdmin under Databases. Yours might look different from mine, but they should work the same.

Accessing Post Revisions with phpMyAdmin

Select the Databases tab in the phpMyAdmin dashboard, and then choose the database you’d like to modify. Make note of the table prefix. You’ll use this in the SQL command. For mine, it’s blurred out a bit, but it will be whatever comes before the underscore. Such as “wp21c9_”.

Accessing Post Revisions with phpMyAdmin

Select the SQL tab, paste this snippet into the field, and run the command.

DELETE FROM yourtableprefix_posts WHERE post_type = "revision";

This will remove all the revisions in that database. Make sure to replace the example yourtableprefix_ with yours.

Manage WordPress Revisions with FTP

Accessing Post Revisions with FTP

You can also limit the number of revisions WordPress stores before they ever build up enough to slow down your site. For this, you will edit your site’s wp-config.php file via an FTP client.

Find the area of the file that is labeled “WordPress Database Table Prefix”, and paste these code snippets in it. This first snippet is what will limit the number of revisions your site keeps.

define('WP_POST_REVISIONS', 3); 

By default, WordPress saves a revision every 60 seconds. This snippet lets you change that interval to something like 120 seconds. Be sure not to set the autosave interval too high, or you will be at a much higher risk of losing content and work.

define('AUTOSAVE_INTERVAL', 120);

Accessing Post Revisions with FTP

And above, you can see what my wp-config.php file looks like after I added these snippets.

And, if you want no revisions at all, you can disable them completely with this code. I don’t recommend having zero revisions kept, however. That is a surefire way to lose content at some point.

define('WP_POST_REVISIONS', false);

As always, I recommend saving a backup before making changes, especially to PHP files. And if you’re not comfortable editing your PGP files, you’re not alone. It is safer to manage your WordPress revisions with a plugin.

Manage WordPress Revisions with a Plugin

WP-Optimize

A plugin is the best method of managing revisions for most users. There are lots of good options, but I recommend WP-Optimize. It has lots of WordPress optimization options and the free version even includes scheduling removal of WordPress post revisions.

WP-Optimize

To optimize your post revisions, go to WP-Optimize > Database in the WordPress dashboard. This automatically opens the Optimizations tab. Check Clean All Post Revisions and click Run Optimizer. On my test site, I have 1,087 post revisions in my database. And right now, I don’t need any of them, so they’re just taking up space.

WP-Optimize

You can also schedule the clean-up to run automatically. Schedule it to run daily or weekly, every two weeks, or even monthly if you want a longer buffer period. Go to the Settings tab in the WP-Optimize > Database settings. Under Schedule Clean-up Settings, check to Enable Scheduled Clean-up and Optimization. Choose the schedule type (weekly is the default setting). Check Clean All Post Revisions and save your settings.

Conclusion

It is not hard to manage WordPress revisions to optimize your site performance. It’s good to have a few to restore when necessary, but too many can take up space in your WordPress database, and as we said, if that continues unchecked, it can have an impact on your site’s performance. Fortunately, there are several options to manage your WordPress revisions. Remember, if you’re not comfortable heading into your PHP files, that’s fine. A simple optimization plugin is the best option for most users anyway.

We want to hear from you. Do you use any of these methods to manage your post revisions? Let us know about your experience in the comments.

Featured Image via hanss / shutterstock.com

Premade Layouts

Check Out These Related Posts

E-A-T SEO and YMYL: Everything You Need to Know

E-A-T SEO and YMYL: Everything You Need to Know

Posted on January 17, 2022 by in WordPress

Google considers many factors when ranking content in its search results. Some of these”signals” affect rankings directly, while others indirectly impact them. E-A-T or Expertise, Authoritativeness, and Trustworthiness are Search Engine Optimization (SEO) elements that Google values....

View Full Post

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today

Pin It on Pinterest