[wp-trac] [WordPress Trac] #57333: Having a huge/really large menu i get: Warning: Undefined array key in C:\xampp\htdocs\wp-includes\nav-menu-template.php

WordPress Trac noreply at wordpress.org
Thu Dec 15 13:20:47 UTC 2022


#57333: Having a huge/really large menu i get: Warning: Undefined array key in
C:\xampp\htdocs\wp-includes\nav-menu-template.php
--------------------------+------------------------------
 Reporter:  mobilebsmith  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------
Changes (by SergeyBiryukov):

 * component:  General => Menus


Old description:

> Would get the warnings below, and menu wouldn't show. Changing the code
> shown here (I left the original in, just commented out. fixed the issue.
>
> ------nav-menu-template.php------
>         // Calculate the depth of each menu item with children.
>         foreach ( $menu_items_with_children as $menu_item_key =>
> &$menu_item_depth ) {
>                 //$menu_item_parent = $menu_items_tree[ $menu_item_key ];
>                 $menu_item_parent = isset($menu_items_tree[
> $menu_item_key ]) ? $menu_items_tree[ $menu_item_key ] : null ;
>                 while ( $menu_item_parent ) {
>                         $menu_item_depth  = $menu_item_depth + 1;
>                         //$menu_item_parent = $menu_items_tree[
> $menu_item_parent ];
>                         $menu_item_parent = isset($menu_items_tree[
> $menu_item_parent ]) ? $menu_items_tree[ $menu_item_parent ] : null ;
>                 }
>         }
>
> ---------
>
> Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
> menu-template.php on line 211
>
> Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
> menu-template.php on line 215
>
> Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
> menu-template.php on line 215

New description:

 Would get the warnings below, and menu wouldn't show. Changing the code
 shown here (I left the original in, just commented out. fixed the issue.
 {{{
 ------nav-menu-template.php------
         // Calculate the depth of each menu item with children.
         foreach ( $menu_items_with_children as $menu_item_key =>
 &$menu_item_depth ) {
                 //$menu_item_parent = $menu_items_tree[ $menu_item_key ];
                 $menu_item_parent = isset($menu_items_tree[ $menu_item_key
 ]) ? $menu_items_tree[ $menu_item_key ] : null ;
                 while ( $menu_item_parent ) {
                         $menu_item_depth  = $menu_item_depth + 1;
                         //$menu_item_parent = $menu_items_tree[
 $menu_item_parent ];
                         $menu_item_parent = isset($menu_items_tree[
 $menu_item_parent ]) ? $menu_items_tree[ $menu_item_parent ] : null ;
                 }
         }

 ---------

 Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
 menu-template.php on line 211

 Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
 menu-template.php on line 215

 Warning: Undefined array key 21700 in C:\xampp\htdocs\wp-includes\nav-
 menu-template.php on line 215
 }}}

--

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


More information about the wp-trac mailing list