Ultimate Guide to WordPress Post Revisions


One of the best things about WordPress is its built-in revision control system. You don’t have to worry that you lose a previous version of your writing, as each revision is separately saved in the database and you can easily move back and forth between them.

WordPress’ revision system works similarly to code version control systems such as Git or Subversion, only it’s almost completely automated (you don’t have to bother with a command line tool). It gives space to an advanced content management workflow and significantly reduces the risk of content loss.

Localize Revisions

Revision management is somewhat hidden in the WP admin, as it doesn’t have its own menu in the sidebar.

You can access it from either the “Edit Post” (Posts > All Posts > Edit) or the “Edit Page” screen (Pages > All Pages > Edit). The “Revisions” menu is located right to the WordPress editor, inside the “Publish” box. Click the “Browse” button to access the revision management screen.

Browse revisions menu in WordPress admin

The revision management screen allows you to check the differences between the different versions of your post. The main part of the page is taken up a diff comparison tool.

Text strings that were removed from the former version are marked with red, while strings added in the next version are marked with green.

WordPress revision screen

There’s another way to access revisions from the “Edit Post” (or “Edit Page”) screen. Open the “Screen Options” menu on the top of the page, and check the “Revisions” option. It adds an extra box below the WordPress editor from where you can access the revisions.

Screen options revisions

As you can see below, the “Revisions” box lists all the revisions you have. You can easily choose the one you want to see by clicking on it.

Revisions tab below WordPress editor

Create Revisions

So, how can you create revisions? As I mentioned before, WordPress’ revision system is quite automated. Whenever you save a post or a page, a new revision is created in the database and a new entry appears on the “Revisions” screen.

Browse revisions menu in WordPress admin

Autosaves

WordPress also creates revisions by its autosave feature. Autosave is enabled for all posts and pages by default and you can’t turn it off, however it’s possible to change the autosave interval (see below). The default value of autosave is 60 seconds.

You don’t have to worry about having too many autosaves in the database, as new autosaves overwrite the old ones. Autosaves don’t rewrite the post (as regular revisions do), they are stored as a special revision type. Their sole purpose is to enable you to restore the autosaved backup if your browser unexpectedly shuts down.

WordPress revisions Autosave feature

Compare Revisions

You can compare two revisions by moving the range slider on top of the Revisions screen. You can also use the “Previous” and “Next” buttons to change the position of the slider.

Note that on this screen, you cannot edit the revisions, only check the differences between them.

Compare adjacent revisions

By default, you can compare two adjacent revisions. However, if you check the “Compare any two revisions” checkbox you can also see the differences between post versions that don’t come after each other.

When this checkbox is checked, the range slider gets two handles and a “From … To … ” box appears below it so that you can easily see which two revisions you are comparing.

Compare any two revisions

Restoring Previous Revision

You can restore any previous revision by selecting the revision you want to restore and clicking the “Restore This Revision” button.

Restore previous revision

After clicking the button, the selected revision appears inside the WordPress post editor and you get a notification on the top of the screen, that reminds you of the restoration.

Update the post and the restored version will be published on the site.

Restored revision in WordPress editor

When you restore a previous revision, the last version of the post is not deleted from the database and you can return to it any time using the same Restore feature.

Configure Revisions in wp-config

You can configure some revision-related settings inside your wp-config file. You can find wp-config.php in the root folder on your server and access it via FTP.

If you are not comfortable with editing root files on your server use a revision editing plugin instead (see a few of them below).

Limit the number of revisions

To save space in your database, you can limit the number of revisions by adding the following line to the beginning of your wp-config file (after the starting <?php tag).


# Saves 5 revisions per post
define( 'WP_POST_REVISIONS', 5 );

Disable revisions

You can also completely disable the post revision feature.


# Disables the post revision feature
define( 'WP_POST_REVISIONS', false );

Change the autosave interval

As aforementioned, the default autosave interval is 60 seconds. You can change this value in your wp-config file with the following code snippet. You need to define the autosave interval in seconds.


# Sets autosave interval to 180 seconds
define( 'AUTOSAVE_INTERVAL', 180 );

Revision Management Plugins

There are a handful of revision management plugins in the WordPress plugin repo. Below, you can find a selection of them (all tested), however it’s not a comprehensive list. You can find all official revision-related WP plugins here on this link.

WP Revision Master

The WP Revision Master plugin allows you to configure revision settings right from your WordPress admin. You can disable revisions, even according to individual post types (posts, pages, products, etc.). You can also set a maximum number of revisions, this way you don’t have to edit your wp-config file on your server.

WordPress Revision Master plugin

Simple Revisions Delete

Simple Revisions Delete is a simple but a very useful plugin. It doesn’t add a separate plugin page to the WP admin, just an elegant “Purge” button to the “Edit Post” screen. It deletes all post revisions belonging to an individual post. Great way to quickly decrease the size of your database.

Beware that the Purge button instantly deletes all revisions, so only click it if you won’t need the revisions in the future.

Simple Revisions Delete plugin

The Simple Revisions Delete plugin also adds a “Purge revisions” option to the “All Posts” and “All Pages” screens. Using this feature, you can get rid of unwanted post revisions in bulk.

Simple Revisions Delete in bulk

Revision Strike

Revision Strike is also a simple plugin but it can help you keep your database clean. It allows you to set the number of days after which the plugin can remove the revisions and the maximum number of revisions to be deleted at the same time.

Revision Strike plugin



Source link