While editing posts, you want to track what has been changed between edits. WordPress lets you do that via a feature called revision. Unfortunately, WordPress revision only supports post title and post content. That might be a problem since you might have content in custom fields (which can be many).
The MB Revision resolves this problem by adding support for custom fields in WordPress revision. You’re able to track changes that you or others have made in custom fields. It works with all field types in Meta Box, even with groups. Using this extension, you will never wonder when you changed or deleted a field.
For more information, please see the extension page.
Before installing the extension, you need to install Meta Box plugin first.
- Go to Plugins → Add New and search for Meta Box
- Click Install Now button to install the plugin
- 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.
- Go to Plugins, click Add new, then click Upload plugin.
- Choose the
.zipfile you downloaded and click Install now
- 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:
Also, in the Publish meta box, you’ll see a link to browse all revisions:
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:
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.
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.