WordPress Post Revisions Made Simple: A Step by Step Guide

WordPress Post Revisions are a useful feature that saves contents on the WordPress site regularly so that in an unlikely event such as when the browser gets crashed or occurrence of power outrages, one can restore the previous version of their posts.

Besides, often while writing an article or blog, writers might make some changes which they regret later. In that case, then can go back to their previous drafts and undo the changes.

The relation between Revisions and Autosave

This feature is also connected with another feature named ‘autosave’. WordPress by default save a copy of the site content in every sixty seconds when one makes changes in them. In other words, every sixty seconds, this saved copy is overwritten repeatedly and as a result, only one autosave exists for every user.

This prevents the content from getting deleted in the unlikely events mentioned earlier. Besides, one can also use the revision interface to access ‘autosave’.

WordPress post revisions

How to manage WordPress Post Revisions

WordPress post revision
After gaining an understanding of how the

WordPress Post revisions

function and its relation to ‘autosave’, it is important to know how one can manage this feature. Following methods can help one in this regard.

1. Using Post Revisions Editor

When a new post is created on WordPress, the post revision feature saves a copy of each draft or the published update. Based on their requirements, users can access the older version of their posts and compare it with the revisions. For this purpose, the users can click on ‘browse’ on the post editor.

This will help them view the changes made in each revision by clicking on ‘previous’ or ‘next’ buttons or dragging a slider. Besides, this will also allow the users to restore any previous version completely if the need be.

Apart from comparing different versions, users can also highlight the changes between two different versions by clicking on the checkbox of ‘Compare any two versions’ followed by using a slider to choose the options they are looking for.

However, the only problem this feature possesses is that the users cannot select and copy a specific part of a text from a particular version directly while comparing different versions as it selects text from both versions.

2. Enabling Global Revisions

When users are developing a WordPress site from the initial stage, the WordPress Post revisions feature automatically enabled into the site with a default setting option that saves every post revision.

If the users cannot see ‘revisions’ as an option in the post setting, it has likely been switched off at the configuration level. To understand the reason the users are required to check the ‘WP-config.php’ file, where the following sentence will appear.

‘define (‘WP_Post_Revisions’, false).

Generally, users have three options in terms of passing values to post revisions. For instance, if the above sentence in the configuration file is considered, the term ‘false’ or ‘0’ means that the revision is turned off entirely and the users are limited to the latest autosave version of their posts.

Again, if instead of the term ‘false’, the word ‘true’ or ‘-1’ appears, it represents the default option in WordPress that allows every revision to be saved per post. Lastly, if these terms are replaced with any number greater than zero, it will limit the number of revisions and the older versions would be deleted.

If the users do not have access to this file, they need to consult their hosting provider. For instance, tools such as WP Sweep Plugin can disable revisions by default only when they are being consulted by the users.

3. Control revisions on a per post basis

If the users are comfortable in some form of custom coding they can use ‘wp_revisions_to_keep filter’ to control the way revision are handled on the level of per post.

This is comparatively simple to implement and requires passing in two parameters to the filter. They are the number of revisions that are required to keep, and a targeted WordPress post object.

Turning off Revisions

While WordPress Post Revisions feature is beneficial for many, they are not ideal for the ones who have limited database space or who don’t require their posts to be autosaved.

In such a situation, users can opt for switching off this feature by adding ‘define (‘WP_Post_Revisions’, false);’ on the ‘WP-config.php’ file. If they want to re-enable the feature, they have to replace the word ’false’ with ‘true’ in the same file. Additionally, users can also limit the number of revisions for each post.

For this, they have to replace the words ’false’ or ‘true’ with their preferred number that they want to limit their revisions to.

Risks involved in using Revision on a live site

While users can manage as well as turn of WordPress Post Revisions features based on their requirement, they should also be aware of the risk involved in its application on a live site.

As every revision of the post content is stored in the database, in larger sites, this database will also turn out to be much larger. Therefore by keeping them on, there is a high chance that the performance of the larger sites will be harmed.

Though it will be difficult to understand the depth of harmful effect this will cause on individual sites; however, it is important to prioritize optimization of the database.

Using Plugins to clean up the existing revisions

After gaining an understanding of how this feature functions, along with how to manage them, turned them off and the risks involved if they are applied to live sites, the users should also understand how they could clear the existing revisions.

The reason behind this is simple. Once, any post passes through the editorial phase, it is useless to keep the older version in the revisions database.

There are many plugins available to help the users in this regard. However, it is advised that as plugins can affect the database, users should keep a backup strategy before experimenting with these plugins.

Thus from the above guidance, the beginners in WordPress post revisions will gain a clear understanding of different aspects associated with this feature.

About Sonnal S Sinha

Sonnal S SinhaSonnal S Sinha shares exciting WordPress themes, plugins and other WordPress related news for our viewers. He also posts selected WordPress developers interviews from time to time.