is_nav_menu_item() WordPress Function
The is_nav_menu_item() function checks whether a given menu item is part of a navigation menu. It takes a menu item object as its only parameter and returns true if the menu item is part of a navigation menu, false otherwise.
is_nav_menu_item( int $menu_item_id ) #
Determines whether the given ID is a nav menu item.
Parameters
- $menu_item_id
(int)(Required)The ID of the potential nav menu item.
Return
(bool) Whether the given ID is that of a nav menu item.
Source
File: wp-includes/nav-menu.php
function is_nav_menu_item( $menu_item_id = 0 ) { return ( ! is_wp_error( $menu_item_id ) && ( 'nav_menu_item' === get_post_type( $menu_item_id ) ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |