Using WP Revisions And Autosave

Have you ever experienced this situation? After spending much time and effort editing a post, something unexpected happens and you suddenly find that you have lost all of your hard work because you didn’t hit the ‘Save’ button as you went along?

If this happens, then worry not! WordPress has a powerful autosave and revision management feature that:

  • Automatically saves your pages and posts,
  • Gets your page or post back if something happens to your browser or computer while you’re working, and,
  • Lets you recover an earlier version if you changed the content in your article and would like to backtrack.

This step-by-step tutorial explains how to use the built-in WordPress autosave and post recovery system to restore your posts and pages while working on your content.

The WordPress Autosave & Revisions Feature: Tutorial

Typically, after saving a post or page, you will see a notice like the example shown below …

Post updated notice

(Post updated notification)

WordPress post revisions ensure that your content is periodically saved, so you can revert back to earlier post revisions if unexpected events happen, for example:

  • Your wireless connection suddenly goes down
  • Your internet browser crashes
  • You experience power outages
  • Internet “gremlins” temporarily prevent you from publishing a post

If this happens and you try to save your work, you might see a ‘WordPress Failure Notice’ like this displayed on your screen instead …

WordPress Failure Notice

(Are you sure you want to do this?)

When you get a message that says “Are you sure you want to do this? Please try again” and click on the ‘Please try again’ link, you will normally go back to a screen displaying an older version of your post, minus any changes that you recently made.

This is where the autosave function of WordPress can really save you time.

The Autosave Feature

Autosaves are automatically enabled for all WordPress pages and posts and stored as a special kind of revision in your site’s database so they will not overwrite the page or post you are working on.

By default, posts are automatically saved to the database every 60 seconds. This time interval can be changed by modifying code in your wp-config.php file.

Warning

We strongly recommend performing a full backup of your data and files before modifying website files.

If you are worried about working with files inside your server, then get some expert help to do it.

If you have been working for a while and something happens (e.g. your browser crashes), you may see a message like this when you get back to editing your post or page …

Autosave notice

(Autosave notification)

Click on the link to view the autosave …

Click to view the autosave

(‘View the autosave’ link)

The Compare Revisions panel displays, allowing you to recover a previously saved version of your article …

Revisions feature

(Revisions feature)

Click the ‘Restore This Autosave’ button …

WordPress offers one-click restore of autosaved content

(WordPress offers one-click restore)

The content you were previously editing will be recovered from autosave …

Autosave restores the content of your latest post revision

(Autosave restores your post)

WordPress Autosave – Additional Info

Sometimes, a ‘Session expired’ message will appear …

WordPress - session expired

(Session expired)

If your login session expires, WordPress remembers where you were. Log in again and continue working from where you left off …

Session expired notice - log in again to continue working

(Session expired notice)

WordPress also warns you if the backup of the post you are looking at is not the same as the version showing in the editor and gives you the opportunity to restore the saved backup.

'The backup of this post in your browser is different from the version below.' notice

(‘The backup of this post in your browser is different from the version below.’ notice)

Click Restore the backup

Edit Post - Restore post backup

(‘The backup of this post in your browser is different from the version below. Restore the backup.’ warning)

WordPress recovers and restores your content from the browser backup. You can also undo this operation by clicking the ‘Undo’ link …

Post recovered successfully!

(Your post has been successfully restored!)

Content Revision Management

Post Revisions were introduced to WordPress in v. 2.6. Whenever a page or post is saved, a revision is automatically created and stored in your WP database.

After WordPress v. 3.6, WordPress made significant enhancements to its post/page revision control feature.

The new WordPress revision system also added a new option to the Page/Post Publish box called Revisions. This lets you immediately know how many revisions you have made.Click ‘Browse’ to quickly access the Compare Revisions work screen …

WordPress automatically records all changes made to your posts

(Publish – Revisions)

The Compare Revisions page loads in your browser …

Revisions section

(Revisions section)

Practical Tip

Note: The WordPress post revision management feature is the same for both Pages and Posts.

How To Compare Revisions

A Revision Slider allows you to move through different saved revisions. The more revisions you have saved, the longer the slider will be …

The more revisions you have, the more segmented your slider will be

(The more revisions you have saved, the longer your slider will be)

Revisions created by editing content and updating posts or pages show up in the revision slider marked in black, along with the save interval, time, and date of the post revision …

Revision marker

(Revision slider)

When WordPress automatically saves posts or pages, your revisions appear in the revision slider marked in red, along with the save interval, time, and date of the post/page revision …

Autosave revision slider

(Autosave marker)

Comparing Revisions – How to Use The Revision Slider

To navigate between post revisions, move the revision slider right or left …

Move the revision slider to the right or left

(Move the button to the left or right of the slider)

There are also buttons to help you navigate between revisions.

Click ‘Previous’ to compare older versions …

Click 'Previous' to browse earlier revisions

(Compare Revisions – ‘Previous’ button)

Click ‘Next’ to review more recent versions …

Compare Revisions - 'Next' button

(Compare Revisions – ‘Next’ button)

As well as comparing adjacent revisions, you can select and compare any two revisions by ticking the ‘Compare any two revisions’ checkbox …

'Compare any two revisions' check box

(Compare any two revisions)

You can adjust the sliders to compare any two versions …

Compare two different revisions

(Compare 2 different post revisions)

Select the version you would like to restore and click the ‘Restore This Revision’ button …

'Restore This Revision' button

(‘Restore This Revision’ button)

To cancel the operation and exit, click the page/post title …

Click the post title to exit

(Click on the title of your post to return)

You can also exit without making any changes by clicking Return to editor

Revisions - return to post editor

(Revisions – return to post editor)

WordPress Revisions – Plugins And Additional Info

As mentioned earlier, there are some changes you can make to the WordPress revisions function such as changing the autosave interval or even disabling the feature altogether, but these typically require modifying server files.

Let’s focus, then, on some additional areas of WordPress revisions management that don’t require messing around with code.

Post Editor Section – View The Post Revisions List

As soon as you create, edit, and save pages and posts, WordPress begins to store new revisions in its database. These show up in a Revisions section at the bottom of the content editor …

Post Editor screen - Viewing the post revisions list

(Post Editor screen – Viewing the WordPress post revisions list)

If you can’t see the Revisions list, click the Screen Options tab at the top of the screen …

Post Editor - Screen Options tab

(Screen Options tab)

Select the box next to ‘Revisions’ in the Boxes section …

Screen Options tab - Revisions

(Post Editor: Screen Options tab – Revisions)

You should now see the Revisions list under your content. Click any of the links to bring up the Compare Revisions screen with saved data for that selected item …

Revisions Box

(Revisions Box)

Page/Post Revision Management Using Plugins

Autosave and revisions are no doubt features that help create a more effective workflow. If you write a lot of content, however, the number of revisions can start to build up. This can significantly increase the size of your WordPress database, so it’s important to manage your revisions.

Post revisions can really add up after a while

(Post revisions can really add up after a while)

For example, if there are 200 posts on your site and each post has 15 revisions your WordPress database could be storing around 3,000 copies of old data. If your post averages 100KB data, then with 3,000 post revisions, the total space wasted is about 300MB.

Fortunately, there are a number of WordPress plugins that can help you control and manage your revisions and reduce the size of your database. Here are some of these:

Better Delete Revision

Better Delete Revision Plugin

(Better Delete Revision – WordPress Plugin)

This plugin deletes redundant revisions of posts from your WordPress database and other database content associated with each revision like relationships, meta information, tags, and more.

After the plugin has been installed and activated, Better Delete Revision can optimize your database.

Log into the WordPress Dashboard and click on Settings > Better Delete Revision

Better Delete Revision - Settings Menu

(Settings Menu – Better Delete Revision)

This brings you to the Better Delete Revision Manager screen. Click the ‘Check Revision Posts’ button to calculate the number of redundant post revisions can be safely deleted from the WordPress database …

Check Revision Posts - Better Delete Revision Manager

(Check Revision Posts – Better Delete Revision Manager)

Depending on the number of posts and revisions related to each post, the plugin calculates and displays a table of revisions stored in your WordPress database …

List of revisions

(Better Delete Revision – Posts revisions)

Click on the ‘Yes, I would like to delete them! …’ button to clear all list items from the database, or exit the tool with all post revisions undeleted …

Better Delete Revision - Delete posts revisions list

(Clear posts revisions list)

The unnecessary items will be deleted from the database …

Better Delete Revision - Revisions removed

(List of post revisions deleted – Better Delete Revision)

Tip

After a while and depending on the amount of content you have published on your website, we recommend repeating this process to keep your database as lean as possible, since WordPress will automatically begin saving your new post revisions again (unless you specifically turn the feature off) …

Post revisions automatically start being stored again!

(Post revisions automatically start being stored again!)

Like the other plugins described in this section, you can also use Better Delete Revisions to keep the site’s database optimized …

Better Delete Revision - Optimize the site's database

(Better Delete Revision Manager – Keep your site’s database optimized)

The plugin checks to see if your database tables need to be optimized and runs a one-click database table optimization routine without the need to log into your server panel or mess with technical software …

Better Delete Revision checks if the WP database tables need to be optimized

(Better Delete Revision lets you perform an easy one-click database optimization routine)

More information: Better Delete Revision WP Plugin

Optimize Database after Deleting Revisions

Optimize Database after Deleting Revisions WP Plugin

(Optimize Database after Deleting Revisions Plugin)

This plugin is similar to the one described above. It not only lets you delete redundant post and page revisions (it also lets you keep a specific number of the most recent revisions) and checks if your database tables need to be optimized, it also lets you perform the following maintenance tasks:

  • Delete trashed pages, comments, and posts
  • Delete unused tags
  • Delete ‘expired transients’
  • Exclude selected tables and specific pages/posts from cleaning and optimization
  • Create a log file of the optimizations
  • And more!

Optimize Database after Deleting Revisions - Settings Page

(Optimize Database after Deleting Revisions WP Plugin – Settings Page)

Visit this site to learn more about this plugin: Optimize Database after Deleting Revisions – WordPress Plugin

WP Optimize

WP-Optimize - WordPress Plugin

(WP-Optimize WP Plugin)

In addition to performing tasks such as removing redundant revisions of pages and posts and checking if the WP database tables need to be cleaned and optimized, WP Optimize also lets you perform the following maintenance tasks:

  • Enable/Disable comments for all published posts
  • Removal of trashed comments
  • Mobile device friendly (optimize your site from anywhere)
  • Remove all transient options
  • Clear out post trash
  • Ability to keep selected number of weeks data when cleaning up
  • Option to add or remove link on WP admin bar
  • Enable/Disable weekly schedules of optimization
  • View database table statistics
  • Receive email notifications after automatic cleanups
  • Marks dangerous cleanup options in red
  • And more!

WP-Optimize - WordPress Plugin Settings

(WP-Optimize Plugin For WordPress – Settings Page)

Go here for more information: WP-Optimize – WordPress Plugin

WP Sweep

WP-Sweep

(WP-Sweep Plugin)

In addition to optimizing your database tables and deleting unnecessary post revisions, this plugin also cleans up:

  • Auto drafts
  • Unapproved comments
  • Orphan post meta
  • Duplicated user meta
  • Unused terms
  • And more!

WP-Sweep - Settings Screen

(WPSweep Plugin – Settings)

Visit the plugin website to learn more about this WordPress plugin: WP Sweep WordPress Plugin

In addition to the above plugins, you can view more plugins that can help you manage post revisions and optimize your database, go to Plugins > Add New and search for keywords like “Revisions“, “Optimize Database“, etc …

Add New Plugins - WordPress Plugins Menu

(Add Plugins – WordPress Plugins Menu)

Congratulations, now you know how to use the WordPress Revisions feature to restore earlier saved post revisions.

Revisions And Autosave Function Of WordPress