From 68b18c62f256bf76ec6b46094a2628780604a6d0 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 6 Jul 2016 18:00:23 +0000 Subject: [PATCH] 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 --- src/wp-includes/meta.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/meta.php b/src/wp-includes/meta.php index 718f42a699..2ea823d360 100644 --- a/src/wp-includes/meta.php +++ b/src/wp-includes/meta.php @@ -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;