How show sub menu only using wp_nav_menu()

I’ve made a free plugin which solves this problem!

https://wordpress.org/plugins/wp-nav-menu-extended/

This plugin extends the native wp_nav_menu function and adds additional options:

  • level : (integer) (required for this plugin to work) The level of the navigation menu to show. If no child_of parameter is passed, it shows all the items of this level
  • child_of : (string|integer) (optional) Either the title or menu item ID of the parent in the menu whose direct children are to be shown

Sample Usage:

$defaults = array( 'theme_location' => 'main_menu', 'level' => 2, 'child_of' => 'About Us', );

wp_nav_menu( $defaults );

Leave a Comment