wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



is_nav_menu › WordPress Function

Od3.0.0
Przestarzałyn/a
is_nav_menu ( $menu )
Parametry:
  • (int|string|WP_Term) $menu Menu ID, slug, name, or object of menu to check.
    Wymagane: Tak
Powrót:
  • (bool) Whether the menu exists.
Zdefiniowane na:
Codex:

Determines whether the given ID is a navigation menu.

Returns true if it is; false otherwise.


Źródło

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