walk_nav_menu_tree() WordPress Function
The walk_nav_menu_tree() function is a Wordpress function that allows you to traverse through the nav menu tree. This is useful for finding the specific nav menu item you are looking for.
walk_nav_menu_tree( array $items, int $depth, stdClass $args ) #
Retrieves the HTML list content for nav menu items.
Parameters
- $items
(array)(Required)The menu items, sorted by each menu item's menu order.
- $depth
(int)(Required)Depth of the item in reference to parents.
- $args
(stdClass)(Required)An object containing wp_nav_menu() arguments.
Return
(string) The HTML list content for the menu items.
Source
File: wp-includes/nav-menu-template.php
function walk_nav_menu_tree( $items, $depth, $args ) { $walker = ( empty( $args->walker ) ) ? new Walker_Nav_Menu : $args->walker; return $walker->walk( $items, $depth, $args ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |