Meta: Make retrieving registered metadata actually work.
The initial implementation used a `single` argument, which has now been added to the whitelist. props Faison. see #35658. Built from https://develop.svn.wordpress.org/trunk@37934 git-svn-id: http://core.svn.wordpress.org/trunk@37875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
42854ca56f
commit
7f5717ba5d
|
@ -997,6 +997,7 @@ function sanitize_meta( $meta_key, $meta_value, $object_type, $object_subtype =
|
|||
* @type string $object_subtype A subtype; e.g. if the object type is "post", the post type.
|
||||
* @type string $type The type of data associated with this meta key.
|
||||
* @type string $description A description of the data attached to this meta key.
|
||||
* @type bool $single Whether the meta key has one value per object, or an array of values per object.
|
||||
* @type string $sanitize_callback A function or method to call when sanitizing `$meta_key` data.
|
||||
* @type string $auth_callback Optional. A function or method to call when performing edit_post_meta, add_post_meta, and delete_post_meta capability checks.
|
||||
* @type bool $show_in_rest Whether data associated with this meta key can be considered public.
|
||||
|
@ -1023,6 +1024,7 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
|
|||
'object_subtype' => '',
|
||||
'type' => 'string',
|
||||
'description' => '',
|
||||
'single' => false,
|
||||
'sanitize_callback' => null,
|
||||
'auth_callback' => null,
|
||||
'show_in_rest' => false,
|
||||
|
@ -1225,9 +1227,9 @@ function get_registered_metadata( $object_type, $object_subtype, $object_id, $me
|
|||
return new WP_Error( 'invalid_meta_key', __( 'Invalid meta key. Not registered.' ) );
|
||||
}
|
||||
$meta_keys = get_registered_meta_keys( $object_type, $object_subtype );
|
||||
$meta_key_data = $meta_keys[ $object_type ][ $object_subtype ][ $meta_key ];
|
||||
$meta_key_data = $meta_keys[ $meta_key ];
|
||||
|
||||
$data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data->single );
|
||||
$data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] );
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-beta1-37933';
|
||||
$wp_version = '4.6-beta1-37934';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue