The "wp_nav_menu_args" filter is applied to the arguments of the wp_nav_menu() function before they are processed.
This filter can be used in the child theme's functions.php to add/remove/modify the arguments of a menu defined in the parent theme.
Also, plugins can use this filter to change menus by adding classes/IDs or using a custom walker object.
The Twenty Thirteen theme defines the following menu in its header.php file.
<?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
The following example code will add an ID to the container and change the "depth" to -1 so that links at all levels are displayed in a single, flat list.
function modify_nav_menu_args( $args ) { if( 'primary' == $args['theme_location'] ) { $args['depth'] = -1; $args['container_id'] = 'my_primary_menu'; } return $args; } add_filter( 'wp_nav_menu_args', 'modify_nav_menu_args' );
The container ID will only show up if you set a menu for this theme location.