Surprisingly WordPress does not have the feature to only display second or third level menu items. The following script will let you display the second or third level menu items by using a fantastic plugin called “wp_nav_menu Extended!” by Junaid Bhura.
Steps to get this working:
default_menu_level_two = array( 'menu' => 'main', 'level' => 2, 'child_of' => (int)$GLOBALS['wpse16243_title'], 'container' => '', 'container_class' => '', 'menu_id' => 'subsite-menu', 'menu_class' => 'subsite-menu hidden-md-down', 'items_wrap' => '<div class="subsite-menu-container"><ul id="%1$s" class="%2$s">%3$s</ul></div>', 'echo' => FALSE, ); $sub_menu_one = wp_nav_menu( $default_menu_level_two ); $default_menu_level_three = array( 'menu' => 'main', 'level' => 3, 'child_of' => (int)$GLOBALS['wpse16243_title'], 'container' => '', 'container_class' => '', 'menu_id' => 'subsite-menu', 'menu_class' => 'subsite-menu hidden-md-down', 'items_wrap' => '<div class="subsite-menu-container"><ul id="%1$s" class="%2$s">%3$s</ul></div>', 'echo' => FALSE, ); $sub_menu_two = wp_nav_menu( $default_menu_level_three ); if(!empty ( $sub_menu_one )){ echo $sub_menu_one; }else if(!empty ( $sub_menu_two )){ echo $sub_menu_two; } wp_reset_query();
<nav id="main-menu"> <ul><?php wp_list_cats();?></ul> </nav>
add_filter( 'wp_list_categories', function( $html ) { return str_replace( ' current-cat', ' current-menu-item', $html ); });