Make WordPress Core

#57333 closed defect (bug) (duplicate)

Having a huge/really large menu i get: Warning: Undefined array key in C:\xampp\htdocs\wp-includes\nav-menu-template.php

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

Description (last modified by SergeyBiryukov)

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

Change History (3)

#1 @SergeyBiryukov
12 months ago

  • Component changed from General to Menus
  • Description modified (diff)

#2 @costdev
12 months ago

Hi @mobilebsmith, welcome to Trac!

This was introduced in [54801]. Pinging @peterwilsoncc to take a look.

#3 @peterwilsoncc
12 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @mobilebsmith and welcome to trac!

This issue has been logged previously and is been tracked in issue #57122. I'll close this issue as a duplicate to keep conversation in one location.

The code is question is likely to be removed in 6.1.2 and replaced with another approach that will solve this issue.

Thanks for getting in touch.

Note: See TracTickets for help on using tickets.