get_registered_nav_menus() WordPress Function

The get_registered_nav_menus() function is used to retrieve the list of registered navigation menus. This function is useful for displaying a list of available menus on a theme's settings page.

get_registered_nav_menus() #

Retrieves all registered navigation menu locations in a theme.


Return

(string[]) Associative array of egistered navigation menu descriptions keyed by their location. If none are registered, an empty array.


Top ↑

Source

File: wp-includes/nav-menu.php

function get_registered_nav_menus() {
	global $_wp_registered_nav_menus;
	if ( isset( $_wp_registered_nav_menus ) ) {
		return $_wp_registered_nav_menus;
	}
	return array();
}


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.