diff --git a/wp-includes/class-wp-customize-setting.php b/wp-includes/class-wp-customize-setting.php index 65fa2e2234..c7cff51fe5 100644 --- a/wp-includes/class-wp-customize-setting.php +++ b/wp-includes/class-wp-customize-setting.php @@ -143,6 +143,11 @@ class WP_Customize_Setting { if ( 'option' === $this->type || 'theme_mod' === $this->type ) { // Other setting types can opt-in to aggregate multidimensional explicitly. $this->aggregate_multidimensional(); + + // Allow option settings to indicate whether they should be autoloaded. + if ( 'option' === $this->type && isset( $args['autoload'] ) ) { + self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] = $args['autoload']; + } } } @@ -173,10 +178,6 @@ class WP_Customize_Setting { * @access protected */ protected function aggregate_multidimensional() { - if ( empty( $this->id_data['keys'] ) ) { - return; - } - $id_base = $this->id_data['base']; if ( ! isset( self::$aggregated_multidimensionals[ $this->type ] ) ) { self::$aggregated_multidimensionals[ $this->type ] = array(); @@ -188,7 +189,10 @@ class WP_Customize_Setting { 'root_value' => $this->get_root_value( array() ), // Root value for initial state, manipulated by preview and update calls. ); } - $this->is_multidimensional_aggregated = true; + + if ( ! empty( $this->id_data['keys'] ) ) { + $this->is_multidimensional_aggregated = true; + } } /** @@ -502,7 +506,11 @@ class WP_Customize_Setting { protected function set_root_value( $value ) { $id_base = $this->id_data['base']; if ( 'option' === $this->type ) { - return update_option( $id_base, $value ); + $autoload = true; + if ( isset( self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload'] ) ) { + $autoload = self::$aggregated_multidimensionals[ $this->type ][ $this->id_data['base'] ]['autoload']; + } + return update_option( $id_base, $value, $autoload ); } else if ( 'theme_mod' ) { set_theme_mod( $id_base, $value ); return true; diff --git a/wp-includes/version.php b/wp-includes/version.php index d687724d4a..65b63fea21 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35304'; +$wp_version = '4.4-alpha-35305'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.