WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/10/2015 10:38:30 PM (6 years ago)
Author:
ocean90
Message:

Customizer: Fix previewing and applying widgets when previewing another theme.

  • Unset wp_get_sidebars_widgets()' non-admin cache var $_wp_sidebars_widgets in Customize theme preview.
  • Add WP_Customize_Setting::$dirty so that settings can be initially-dirty when the Customizer loads.
  • Mark old_sidebars_widgets_data setting initially-dirty.
  • Mark all sidebars_widgets settings as initially-dirty during theme switch.

props westonruter.
see #31484.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-customize-widgets.php

    r31544 r31705  
    217217        $sidebars_widgets = retrieve_widgets( 'customize' );
    218218        add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
     219        unset( $GLOBALS['_wp_sidebars_widgets'] ); // reset global cache var used by wp_get_sidebars_widgets()
    219220    }
    220221
     
    333334            $setting_args = $this->get_setting_args( $setting_id, array(
    334335                'type' => 'global_variable',
     336                'dirty' => true,
    335337            ) );
    336338            $this->manager->add_setting( $setting_id, $setting_args );
     
    357359                $setting_args = $this->get_setting_args( $setting_id );
    358360                if ( ! $this->manager->get_setting( $setting_id ) ) {
     361                    if ( ! $this->manager->is_theme_active() ) {
     362                        $setting_args['dirty'] = true;
     363                    }
    359364                    $this->manager->add_setting( $setting_id, $setting_args );
    360365                }
Note: See TracChangeset for help on using the changeset viewer.