Uses
Uses | Description |
---|---|
wp-includes/nav-menu.php: wp_get_nav_menu_object() | Returns a navigation menu object. |
wp-includes/load.php: is_wp_error() | Check whether variable is a WordPress Error. |
Check if the given ID is a navigation menu.
Returns true if it is; false otherwise.
(int|string|WP_Term) (Required) Menu ID, slug, name, or object of menu to check.
(bool) Whether the menu exists.
File: wp-includes/nav-menu.php
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; }
Version | Description |
---|---|
3.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_nav_menu