[wp-trac] [WordPress Trac] #20564: Framework for storing revisions of Post Meta
WordPress Trac
noreply at wordpress.org
Thu Mar 28 19:45:47 UTC 2013
#20564: Framework for storing revisions of Post Meta
-------------------------+------------------
Reporter: alexkingorg | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.6
Component: Revisions | Version:
Severity: normal | Resolution:
Keywords: |
-------------------------+------------------
Comment (by WraithKenny):
I think we just need a few new wrapper functions (like
`add_versioned_meta()`, `update_versioned_meta()`, and
`delete_versioned_meta()` ) that don't check against
`wp_is_post_revision()`. Using these would "opt in" to metadata on
revisions. (of course you could currently just use `*_metadata('post'...)`
functions, no?)
then on 'wp_restore_post_revision' (with 2 args)
{{{
$meta = get_post_meta( $revision_id, $key );
if ( empty( $meta ) )
delete_post_meta( $post_id, $key );
else
update_post_meta( $post_id, $key, $meta );
// or whatnot.
}}}
which is pretty straight forward (and also "opt in").
Optionally, core can hook onto 'wp_restore_post_revision' and loop thru a
filterable array of "versioned" meta so that the following could work:
{{{
add_filter( 'versioned_meta', 'my_versioned_meta' );
function my_versioned_meta( $meta_keys ) {
$meta_keys[] = 'my_key';
return $meta_keys;
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20564#comment:32>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list