I am new to wordpress and was encountered the Warning: Undefined array key 5408 in C:\xampp\htdocs\Bridge\wp-includes\nav-menu-template.php on line 210, is there any solution for me to fix this issue?
$sorted_menu_items = array();
$menu_items_tree = array();
$menu_items_with_children = array();
foreach ( (array) $menu_items as $menu_item ) {
$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
$menu_items_tree[ $menu_item->ID ] = $menu_item->menu_item_parent;
if ( $menu_item->menu_item_parent ) {
$menu_items_with_children[ $menu_item->menu_item_parent ] = 1;
}
// 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 ];
}
}
}
Your $menu_items_with_children is just an empty array! Please check it carefully.