Meta: Ensure `$object_subtype` is available before use in `register_meta()`.

Props sc0ttkclark.
See #35658.

Built from https://develop.svn.wordpress.org/trunk@37990


git-svn-id: http://core.svn.wordpress.org/trunk@37931 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Jeremy Felt 2016-07-06 18:01:30 +00:00
parent ff6a4875a8
commit dc57f35048
2 changed files with 8 additions and 3 deletions

View File

@ -1075,6 +1075,12 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
} }
} }
$object_subtype = '';
if ( ! empty( $args['object_subtype'] ) ) {
$object_subtype = $args['object_subtype'];
}
// Back-compat: old sanitize and auth callbacks applied to all of an object type // Back-compat: old sanitize and auth callbacks applied to all of an object type
if ( $has_old_sanitize_cb ) { if ( $has_old_sanitize_cb ) {
add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 );
@ -1090,8 +1096,7 @@ function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
} }
// Global registry only contains meta keys registered in the new way with a subtype. // Global registry only contains meta keys registered in the new way with a subtype.
if ( ! empty( $args['object_subtype'] ) ) { if ( ! empty( $object_subtype ) ) {
$object_subtype = $args['object_subtype'];
$wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args; $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args;
return true; return true;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.6-beta1-37989'; $wp_version = '4.6-beta1-37990';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.