rockschtar/wordpress-metarevisions

Library for use with roots/bedrock based WordPress projects. Enables meta-data revisions.

Installs: 1 879

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:wordpress-muplugin

2.1.7 2020-01-24 10:35 UTC

This package is auto-updated.

Last update: 2022-06-24 16:18:04 UTC


README

Description

WordPress Must Use Plugin. Enables meta-data revisions via simplified hooks/filters for usage with composer based based WordPress projects (roots/bedrock or johnpbloch/wordpress).

Requirements

Install

composer require rockschtar/wordpress-metarevisions

License

rockschtar/wordpress-metarevisions is open source and released under MIT license. See LICENSE.md file for more info.

Usage

This library allows you to store changes in post meta fields to the built in WordPress Revision Management System.

MetaRevisions::init();

add_filter('rswpmr_revision_meta_fields', function($fields) {
    $fields['your_post_type_name']['your_post_meta_field'] = __('Your Meta Field Title');
    return $fields;
});

add_filter('rswpmr_revision_meta_fields_callbacks', function($field_callbacks) {
    $field_callbacks[] = array('field' => 'your_post_meta_field', 'callback' => function($value, $field) {
        //option to convert your post meta value to a readable value
        return $value;
    });

    return $field_callbacks;
});

Question? Issues?

rockschtar/wordpress-metarevisions is hosted on GitHub. Feel free to open issues there for suggestions, questions and real issues.