[wp-trac] [WordPress Trac] #52949: All available nav menu locations checked by default when creating a new menu

WordPress Trac noreply at wordpress.org
Thu Apr 1 04:11:01 UTC 2021


#52949: All available nav menu locations checked by default when creating a new
menu
-------------------------------------+-----------------------------
 Reporter:  Chouby                   |       Owner:  davidbaumwald
     Type:  defect (bug)             |      Status:  assigned
 Priority:  normal                   |   Milestone:  5.7.1
Component:  Menus                    |     Version:  5.5
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-refresh  |     Focuses:  administration
-------------------------------------+-----------------------------

Comment (by mukesh27):

 Replying to [comment:9 davidbaumwald]:
 > {{{
 > $checked = false;
 >
 > if ( isset( $menu_locations[ $location ] )
 >     && 0 !== $nav_menu_selected_id
 >     && $menu_locations[ $location ] === $nav_menu_selected_id
 > ) {
 >     $checked = true;
 > }
 > }}}
 > Versus the existing, one-liner setup.
 > {{{
 > $checked = isset( $menu_locations[ $location ] ) && 0 !==
 $nav_menu_selected_id && $menu_locations[ $location ] ===
 $nav_menu_selected_id;
 > }}}

 After using this code snippet if I'm going to add new menu without any
 menu items and menu location it automatically select all menu location.

 Check attached screenshot

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52949#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list