Make WordPress Core

#57160 closed defect (bug) (duplicate)

Problem nav-menu-template.php

Reported by: userbleona's profile userbleona Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1.1
Component: Menus Keywords:
Focuses: Cc:

Description (last modified by SergeyBiryukov)

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?

Change History (1)

#1 @SergeyBiryukov
17 months ago

  • Component changed from General to Menus
  • Description modified (diff)
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there, welcome to WordPress Trac!

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

Note: See TracTickets for help on using tickets.