WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/24/17 18:34:21 (4 weeks ago)
Author:
obenland
Message:

Customize: Allow previewed menus to be customized

Fixes a bug where menu assignements couldn't be changed when previewing a theme.
Also removes an unnecessary call to menu mapping after a theme switch from the customizer and makes sure the locations option is always written, for good measure.

Props westonruter.
See #39692.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r41937 r41995  
    695695 
    696696    $nav_menu_locations = get_theme_mod( 'nav_menu_locations' ); 
    697     add_option( 'theme_switch_menu_locations', $nav_menu_locations ); 
     697    update_option( 'theme_switch_menu_locations', $nav_menu_locations ); 
    698698 
    699699    if ( func_num_args() > 1 ) { 
     
    27252725        $old_theme = wp_get_theme( $stylesheet ); 
    27262726 
    2727         // Prevent retrieve_widgets() from running since Customizer already called it up front 
     2727        // Prevent widget & menu mapping from running since Customizer already called it up front 
    27282728        if ( get_option( 'theme_switched_via_customizer' ) ) { 
     2729            remove_action( 'after_switch_theme', '_wp_menus_changed' ); 
    27292730            remove_action( 'after_switch_theme', '_wp_sidebars_changed' ); 
    27302731            update_option( 'theme_switched_via_customizer', false ); 
Note: See TracChangeset for help on using the changeset viewer.