[wp-trac] [WordPress Trac] #57160: Problem nav-menu-template.php

WordPress Trac noreply at wordpress.org
Mon Nov 21 13:22:22 UTC 2022


#57160: Problem nav-menu-template.php
--------------------------+------------------------
 Reporter:  userbleona    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Menus         |     Version:  6.1.1
 Severity:  normal        |  Resolution:  duplicate
 Keywords:                |     Focuses:
--------------------------+------------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => duplicate
 * component:  General => Menus
 * milestone:  Awaiting Review =>


Old description:

> Hello,
> In my web show the statement** Notice: Undefined offset: 6994 in
> /home3/xiddjsgr/public_html/dekra/wp-includes/nav-menu-template.php on
> line 211**, and the code on line 211 is:
>
> ''// 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 ];
>                 while ( $menu_item_parent ) {
>                         $menu_item_depth  = $menu_item_depth + 1;
>                         $menu_item_parent = $menu_items_tree[
> $menu_item_parent ];
>                 }
>         }
>
>         // Add the menu-item-has-children class where applicable.
>         if ( $menu_items_with_children ) {
>                 foreach ( $sorted_menu_items as &$menu_item ) {
>                         if (
>                                 isset( $menu_items_with_children[
> $menu_item->ID ] ) &&
>                                 ( $args->depth <= 0 ||
> $menu_items_with_children[ $menu_item->ID ] < $args->depth )
>                         ) {
>                                 $menu_item->classes[] = 'menu-item-has-
> children';
>                         }
>                 }
>         }
>
>         unset( $menu_items_tree, $menu_items_with_children, $menu_items,
> $menu_item );''
>
> **Version wordpress 6.1.1**
> What should i do?

New description:

 Hello,
 In my web show the statement** Notice: Undefined offset: 6994 in
 /home3/xiddjsgr/public_html/dekra/wp-includes/nav-menu-template.php on
 line 211**, and the code on line 211 is:
 {{{
 // 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 ];
                 while ( $menu_item_parent ) {
                         $menu_item_depth  = $menu_item_depth + 1;
                         $menu_item_parent = $menu_items_tree[
 $menu_item_parent ];
                 }
         }

         // Add the menu-item-has-children class where applicable.
         if ( $menu_items_with_children ) {
                 foreach ( $sorted_menu_items as &$menu_item ) {
                         if (
                                 isset( $menu_items_with_children[
 $menu_item->ID ] ) &&
                                 ( $args->depth <= 0 ||
 $menu_items_with_children[ $menu_item->ID ] < $args->depth )
                         ) {
                                 $menu_item->classes[] = 'menu-item-has-
 children';
                         }
                 }
         }

         unset( $menu_items_tree, $menu_items_with_children, $menu_items,
 $menu_item );
 }}}

 **Version wordpress 6.1.1**
 What should i do?

--

Comment:

 Hi there, welcome to WordPress Trac!

 Thanks for the report, we're already tracking this issue in #57122 and
 #56926.

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


More information about the wp-trac mailing list