Make WordPress Core

Changeset 50938


Ignore:
Timestamp:
05/20/2021 04:51:16 AM (5 years ago)
Author:
peterwilsoncc
Message:

Menus: Do not auto-set locations for new menus.

Do not auto-set new menus to all vacant locations on the Appearance > Menus screen in the dashboard.

Follow up to [48051].

Props Chouby, audrasjb, davidbaumwald, mukesh27.
Fixes #52949.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/nav-menus.php

    r50931 r50938  
    339339                                                wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
    340340                                        }
    341 
    342                                         // Set the menu_location value correctly for the newly created menu.
    343                                         foreach ( $menu_locations as $location => $id ) {
    344                                                 if ( 0 === $id ) {
    345                                                         $menu_locations[ $location ] = $nav_menu_selected_id;
    346                                                 }
    347                                         }
    348 
    349                                         set_theme_mod( 'nav_menu_locations', $menu_locations );
    350341
    351342                                        if ( isset( $_REQUEST['zero-menu-state'] ) || ! empty( $_POST['auto-add-pages'] ) ) {
    … …  
    10431034                                                                                <?php
    10441035                                                                                foreach ( $locations as $location => $description ) :
    1045                                                                                         $checked = isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] === $nav_menu_selected_id;
     1036                                                                                        $checked = false;
     1037
     1038                                                                                        if ( isset( $menu_locations[ $location ] )
     1039                                                                                                        && 0 !== $nav_menu_selected_id
     1040                                                                                                        && $menu_locations[ $location ] === $nav_menu_selected_id
     1041                                                                                        ) {
     1042                                                                                                        $checked = true;
     1043                                                                                        }
    10461044                                                                                        ?>
    10471045                                                                                        <div class="menu-settings-input checkbox-input">
Note: See TracChangeset for help on using the changeset viewer.