Post Revisions

One of the main features of any Content Management System is revision control. WordPress is no different. WordPress provides revision control for pages and posts that you create, allowing you to go back to any of the older versions later.  Read on to understand how you can create, compare, and limit these revisions.

Creating Revisions

  1. Publish a new post.

 

  1. Update the post. A new version is created.

 

Note: WordPress will also save your changes every 2 minutes. These automatic saves will be marked [Autosave].

Comparing Revisions

To start the revisions layout, click on the date of any of the revisions in the metabox. You will see two copies side by side with the changes highlighted. A scroll bar at the top of the screen allows you to browse through all your revisions. By default, all of the revisions are compared the current version. However, if you want to compare two older versions instead, click the box marked “Compare two revisions”. When you have a valid older revision that can be restored, a blue Restore This Revision button will appear. Click that button to roll back your post to that revision.

Limiting Revisions

WordPress enables the Post Revision feature by default. While this may seem like a great idea at the onset, it may be lead to potential problems if left uncontrolled. For instance let’s say that you’ve published a post and then updated it about 5 times. For each of those updates, you might have just changed around a word or two, or made some very minimal changes. However in the WordPress database you would now have 6 copies of your original post, the 1 main one and 5 updates storing the full content of that past revision and not just the changes made since the last one. So an uncountable number of entries have been created in your database, with or without your knowledge. This may eventually swamp your database resources and end up making it sluggish. Hence it is important to limit this number to an acceptable value. This can be achieved by adding a line in your wp-config.php file. For more details, see Messing with your Config file (provide cross-link).

define(‘WP_POST_REVISIONS’,3); // up to 3 revisions per post

You can also disable the feature completely by setting this value to false (0).

define(‘WP_POST_REVISIONS’,0);

Deleting a Revision

There is no simple way to delete a version once it is created. One way to do it is to delete the post from the wp_posts tables in your database. This is obviously too cumbersome. There are many plugins available that make your life easier, some of them are listed below:

  1. Better Delete Version

  2. Revision Removal