Displays a navigation menu.

Optional $args contents:

menu – The menu that is desired. Accepts (matching in order) id, slug, name. Defaults to blank. menu_class – CSS class to use for the ul element which forms the menu. Defaults to ‘menu’. menu_id – The ID that is applied to the ul element which forms the menu. Defaults to the menu slug, incremented. container – Whether to wrap the ul, and what to wrap it with. Defaults to ‘div’. container_class – the class that is applied to the container. Defaults to ‘menu-{menu slug}-container’. container_id – The ID that is applied to the container. Defaults to blank. fallback_cb – If the menu doesn’t exists, a callback function will fire. Defaults to ‘wp_page_menu’. Set to false for no fallback. before – Text before the link text. after – Text after the link text. link_before – Text before the link. link_after – Text after the link. echo – Whether to echo the menu or return it. Defaults to echo. depth – how many levels of the hierarchy are to be included. 0 means all. Defaults to 0. walker – allows a custom walker to be specified. theme_location – the location in the theme to be used. Must be registered with register_nav_menu() in order to be selectable by the user. items_wrap – How the list items should be wrapped. Defaults to a ul with an id and class. Uses printf() format with numbered placeholders.


wp_nav_menu( $args = array() )
 (array) Arguments
Default: array()




function wp_nav_menu( $args = array() ) {
	static $menu_id_slugs = array();

	$defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '',
	'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
	'depth' => 0, 'walker' => '', 'theme_location' => '' );

	$args = wp_parse_args( $args, $defaults );
	 * Filter the arguments used to display a navigation menu.
	 * @since 3.0.0
	 * @param array $args Arguments from {@see wp_nav_menu()}.
	$args = apply_filters( 'wp_nav_menu_args', $args );
	$args = (object) $args;

	// Get the nav menu based on the requested menu
	$menu = wp_get_nav_menu_object( $args->menu );
147 more lines...
WP Trac GitHub

Link here