Category: How to show only second level child menu in wordpress

How to display only second level child menu in wordpress

Below is snippet code to display second level menu in wordpress. Put below php code into your theme/functions.php file add_filter( ‘wp_nav_menu_objects’, ‘my_wp_nav_menu_objects_sub_menu’, 10, 2 ); // filter_hook function to react on sub_menu flag function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) { if ( isset( $args->sub_menu ) ) { $root_id = 0; // find the current menu item […]