From dc57f3504812a3c6e828b05f37b92f3c231d542f Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Wed, 6 Jul 2016 18:01:30 +0000 Subject: [PATCH] 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 --- wp-includes/meta.php | 9 +++++++-- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 718f42a699..2ea823d360 100644 --- a/wp-includes/meta.php +++ b/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; diff --git a/wp-includes/version.php b/wp-includes/version.php index f477f4b813..37a05864e0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @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.