Customize: Ensure `WP_Customize_Setting::value()` returns previewed value for custom types utilizing the `customize_value_{$id_base}` filter.

Fixes #38864.

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


git-svn-id: http://core.svn.wordpress.org/trunk@39258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2016-11-19 06:00:34 +00:00
parent 7ba9399fbd
commit 224ee52ea7
3 changed files with 16 additions and 4 deletions

View File

@ -696,6 +696,15 @@ class WP_Customize_Setting {
$is_core_type = ( 'option' === $this->type || 'theme_mod' === $this->type ); $is_core_type = ( 'option' === $this->type || 'theme_mod' === $this->type );
if ( ! $is_core_type && ! $this->is_multidimensional_aggregated ) { if ( ! $is_core_type && ! $this->is_multidimensional_aggregated ) {
// Use post value if previewed and a post value is present.
if ( $this->is_previewed ) {
$value = $this->post_value( null );
if ( null !== $value ) {
return $value;
}
}
$value = $this->get_root_value( $this->default ); $value = $this->get_root_value( $this->default );
/** /**

View File

@ -132,10 +132,13 @@ final class WP_Customize_Custom_CSS_Setting extends WP_Customize_Setting {
* @return string * @return string
*/ */
public function value() { public function value() {
$id_base = $this->id_data['base']; if ( $this->is_previewed ) {
if ( $this->is_previewed && null !== $this->post_value( null ) ) { $post_value = $this->post_value( null );
return $this->post_value(); if ( null !== $post_value ) {
return $post_value;
}
} }
$id_base = $this->id_data['base'];
$value = ''; $value = '';
$post = wp_get_custom_css_post( $this->stylesheet ); $post = wp_get_custom_css_post( $this->stylesheet );
if ( $post ) { if ( $post ) {

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.7-beta4-39317'; $wp_version = '4.7-beta4-39318';
/** /**
* 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.