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.


Top ↑

Return

(string) The HTML list content for the menu items.


Top ↑

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 );
}


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.