GithubHelp home page GithubHelp logo

isabella232 / wp-post-meta-revisions Goto Github PK

View Code? Open in Web Editor NEW

This project forked from humanmade/wp-post-meta-revisions

0.0 0.0 0.0 874 KB

plugin for https://core.trac.wordpress.org/ticket/20564

License: GNU General Public License v2.0

Shell 20.47% PHP 79.53%

wp-post-meta-revisions's Introduction

Build Status

=== WP-Post-Meta-Revisions ===

Allow selected post meta keys to be tracked in revisions.

== Description ==

This plugin implements a post meta revisioning feature as arrived at in https://core.trac.wordpress.org/ticket/20564.

The goal of releasing this code as a plugin is to allow as many people as possible to easily test the post meta revisioning feature, and also hopefully move towards inclusion of the feature into core, following the Features as Plugins model.

Further development of the code for this plugin will continue on its GitHub repository. Pull requests welcome!

To use this plugin, you must be running WordPress 4.1 or newer, two hooks were added in 4.1 that are required for this implementation.

To revision a post meta, you add its key via a filter:

function add_meta_keys_to_revision( $keys ) {
	$keys[] = 'meta-key-to-revision';
	return $keys;
}
add_filter( 'wp_post_revision_meta_keys', 'add_meta_keys_to_revision' );

Features:

  • Allows for a whitelisted array of 'revisioned' meta keys (which can change at any time)
  • A revision for the meta is stored on save (if the meta value has changed)
  • A meta revision save (if changed) is also triggered during auto-saves
  • Restoring a revision restores the revisioned meta field's values at that revision (including auto-saves)
  • Supports storing of multiple values for a single key (and restoring them)
  • Adds revisioned meta to the preview data via get_post_metadata
  • Includes unit tests demonstrating feature
  • Travis CI tests integrated with GitHub repository, props @mattheu

wp-post-meta-revisions's People

Contributors

bobbravo2 avatar hingst avatar jrfnl avatar mattheu avatar tfrommen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.