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

Props sc0ttkclark.
See #35658.


git-svn-id: https://develop.svn.wordpress.org/trunk@37990 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2016-07-06 18:00:23 +00:00
parent 194c8d0e33
commit 68b18c62f2

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
if ( $has_old_sanitize_cb ) {
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.
if ( ! empty( $args['object_subtype'] ) ) {
$object_subtype = $args['object_subtype'];
if ( ! empty( $object_subtype ) ) {
$wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args;
return true;