MB Revision

Improve this page

Installation

Before installing the extension, you need to install Meta Box plugin first.

  1. Go to Plugins → Add New and search for Meta Box
  2. Click Install Now button to install the plugin
  3. After installing, click Activate Plugin to activate the plugin

The extension is just a WordPress plugin, you can install it like a normal WordPress plugin.

  1. Go to Plugins, click Add new, then click Upload plugin.
  2. Choose the .zip file you downloaded and click Install now
  3. After finishing upload, click Activate to finish.

Important: This extension requires Meta Box version 4.12+. If you’re using an older version of the plugin, please update.

Enabling revision support

First of all, please make sure that you didn’t turn off revision in WordPress. To check this, please open your wp-config.php and see if this line presents:

define( 'WP_POST_REVISIONS', false );

If you can’t find it, that means revision is turned on, which is great!

Now back to Meta Box. Please make sure you understand how to create meta boxes before continuing.

To enable revision support for a meta box, simply add a new setting to the meta box as follows:

'revision' => true,

Now whenever you update a post, WordPress will create a revision for it. And MB Revision ensures all the values of the custom fields are copied from the parent post to that revision.

Comparing the changes

When you update a post, WordPress automatically creates a revision for that post. You can see the list of revisions in the Revisions meta box below the main editor:

revision list

Also, in the Publish meta box, you’ll see a link to browse all revisions:

browse revision

Clicking either on any revision in the list or on Browse link brings you to the revision comparison screen. There you’ll see something like this:

revision compare

Except title and content, which are post fields, other items on this screen are custom fields created by Meta Box. There you’ll see highlighted lines or words, which are added or removed by users.

If the custom field has simple value (like a string), it will display fully here. If the custom field has structural value (array), it will display here as a JSON-encoded string. Using JSON allows you to see the values of each element in the array as well as the structure in general.

Please note that the extension works well with Meta Box Group extension.

Restoring the revision

If you find out that the current version of the post is incorrect, you can compare it with the previous version and optionally restore it. In order to restore a revision, simply click on the Restore this revision button on the comparison screen.

MB Revision will copy values of the custom fields from the revision to the parent post. So your post will have the correct values of custom fields like it used to be.

Notes

Because WordPress supports revision for posts and custom post types only, the extension doesn’t work for term meta, user meta or settings pages.

Please make sure you either not define WP_POST_REVISIONS or set it to a proper value in wp-config.php. This constant disables or limits the number of revisions. Therefore, it might cause unexprected result. Please see WordPress Codex for more information.