WordPress at Your Fingertips

get_nav_menu_locations() WP 1.0

Used By: has_nav_menu()
1 time — 0.000063 sec (very fast) | 50000 times — 1 sec (very fast)

No Hooks.

Return

Int[]. Associative array of egistered navigation menu IDs keyed by their location name. If none are registered, an empty array.

Usage

get_nav_menu_locations();

Changelog

Since 3.0.0 Introduced.

Code of get_nav_menu_locations() WP 5.8.1

function get_nav_menu_locations() {
	$locations = get_theme_mod( 'nav_menu_locations' );
	return ( is_array( $locations ) ) ? $locations : array();
}

nav menu (nav_menu)

Menu

No comments
    Log In