Changeset 28124 for trunk/src/wp-includes/theme.php
- Timestamp:
- 04/14/2014 10:45:40 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/theme.php
r27879 r28124 753 753 */ 754 754 function switch_theme( $stylesheet ) { 755 global $wp_theme_directories, $sidebars_widgets; 756 757 if ( is_array( $sidebars_widgets ) ) 758 set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $sidebars_widgets ) ); 755 global $wp_theme_directories, $wp_customize, $sidebars_widgets; 756 757 $_sidebars_widgets = null; 758 if ( 'wp_ajax_customize_save' === current_action() ) { 759 $_sidebars_widgets = $wp_customize->post_value( $wp_customize->get_setting( 'old_sidebars_widgets_data' ) ); 760 } elseif ( is_array( $sidebars_widgets ) ) { 761 $_sidebars_widgets = $sidebars_widgets; 762 } 763 764 if ( is_array( $_sidebars_widgets ) ) { 765 set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $_sidebars_widgets ) ); 766 } 759 767 760 768 $old_theme = wp_get_theme(); … … 783 791 update_option( 'current_theme', $new_name ); 784 792 793 // Migrate from the old mods_{name} option to theme_mods_{slug}. 785 794 if ( is_admin() && false === get_option( 'theme_mods_' . $stylesheet ) ) { 786 795 $default_theme_mods = (array) get_option( 'mods_' . $new_name ); 787 796 add_option( "theme_mods_$stylesheet", $default_theme_mods ); 797 } else { 798 /* 799 * Since retrieve_widgets() is called when initializing the customizer theme, 800 * we need to to remove the theme mods to avoid overwriting changes made via 801 * the widget customizer when accessing wp-admin/widgets.php. 802 */ 803 if ( 'wp_ajax_customize_save' === current_action() ) { 804 remove_theme_mod( 'sidebars_widgets' ); 805 } 788 806 } 789 807 … … 1792 1810 $old_theme = wp_get_theme( $stylesheet ); 1793 1811 1812 // Prevent retrieve_widgets() from running since Customizer already called it up front 1813 if ( get_option( 'theme_switched_via_customizer' ) ) { 1814 remove_action( 'after_switch_theme', '_wp_sidebars_changed' ); 1815 update_option( 'theme_switched_via_customizer', false ); 1816 } 1817 1794 1818 if ( $old_theme->exists() ) { 1795 1819 /**
Note: See TracChangeset
for help on using the changeset viewer.