wp_nav_menu_max_depth() WordPress Function

The wp_nav_menu_max_depth() function allows you to set the maximum depth for a navigation menu. This can be useful if you want to create a nested menu structure but don't want it to go too deep. The default value for this function is 0, which means there is no maximum depth.

wp_nav_menu_max_depth( string $classes ) #


Parameters

$classes

(string)(Required)


Top ↑

Return

(string)


Top ↑

Source

File: wp-admin/nav-menus.php

function wp_nav_menu_max_depth( $classes ) {
	global $_wp_nav_menu_max_depth;
	return "$classes menu-max-depth-$_wp_nav_menu_max_depth";
}

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.