Show top-level parent with submenu menu walker

You can try to skip the following if-condition in the start_el() method in your child_menu_walker class:

if ($item->menu_item_parent != $parent_item_id ) {
    //...
}

which is equal to:

if ($item->menu_item_parent != 0 ) {
    //...
}

since you have $parent_item_id = 0.

So it looks like this condition is filtering out your top-level parent.

You might also want to reconsider this condition:

&& $item->menu_item_parent != $parent_item_id

in the end_el() method.

Leave a Comment