wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



is_nav_menu › WordPress Function

Da3.0.0
Deprecaton/a
is_nav_menu ( $menu )
Parametri:
  • (int|string|WP_Term) $menu Menu ID, slug, name, or object of menu to check.
    Richiesto:
Ritorna:
  • (bool) Whether the menu exists.
Definito a:
Codex:

Determines whether the given ID is a navigation menu.

Returns true if it is; false otherwise.


Sorgenti

function is_nav_menu( $menu ) {
	if ( ! $menu ) {
		return false;
	}

	$menu_obj = wp_get_nav_menu_object( $menu );

	if (
		$menu_obj &&
		! is_wp_error( $menu_obj ) &&
		! empty( $menu_obj->taxonomy ) &&
		'nav_menu' === $menu_obj->taxonomy
	) {
		return true;
	}

	return false;
}