Display all submenus
Ok, the problem in my solution was the use of $menu_item->ID instead of $menu_item->object_id. So the full correct logic is like so: function print_sub_menus() { global $post; // get current page $post_id = $post ? $post->ID : -1; $has_post_parent = $post && $post->post_parent; $top = $has_post_parent ? array_pop( get_post_ancestors($post_id) ) : $post_id; // get all … Read more