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 |
---|---|
135 | */ |
136 | function wp_nav_menu( $args = array() ) { |
137 | static $menu_id_slugs = array(); |
138 |
|
139 | $defaults = array( 'menu' => '', 'container' => 'div', 'container_class' => '', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', |
140 | '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>', |
141 | 'depth' => 0, 'walker' => '', 'theme_location' => '' ); |
142 |
|
143 | $args = wp_parse_args( $args, $defaults ); |
144 | $args = apply_filters( 'wp_nav_menu_args', $args ); |
145 | $args = (object) $args; |
146 |
|
147 | // Get the nav menu based on the requested menu |
148 | $menu = wp_get_nav_menu_object( $args->menu ); |
149 |
|
150 | // Get the nav menu based on the theme_location |
151 | if ( ! $menu && $args->theme_location && ( $locations = get_nav_menu_locations() ) && isset( $locations[ $args->theme_location ] ) ) |
152 | $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); |
153 |
|