WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
136 | */ |
137 | function wp_nav_menu( $args = array() ) { |
138 | static $menu_id_slugs = array(); |
139 |
|
140 | $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', |
141 | '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>', |
142 | 'depth' => 0, 'walker' => '', 'theme_location' => '' ); |
143 |
|
144 | $args = wp_parse_args( $args, $defaults ); |
145 | $args = apply_filters( 'wp_nav_menu_args', $args ); |
146 | $args = (object) $args; |
147 |
|
148 | // Get the nav menu based on the requested menu |
149 | $menu = wp_get_nav_menu_object( $args->menu ); |
150 |
|
151 | // Get the nav menu based on the theme_location |
152 | if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) |
153 | $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); |
154 |
|