On this page
is_nav_menu_item( int $menu_item_id ): bool
Determines whether the given ID is a nav menu item.
Parameters
$menu_item_idint 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. View all references
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 ) ) );
}
Related
Uses
| Uses | Description |
|---|---|
| get_post_type() wp-includes/post.php | Retrieves the post type of the current post or of a given post. |
| is_wp_error() wp-includes/load.php | Checks whether the given variable is a WordPress Error. |
Used By
| Used By | Description |
|---|---|
| wp_nav_menu_update_menu_items() wp-admin/includes/nav-menu.php | Saves nav menu items |
| wp_get_associated_nav_menu_items() wp-includes/nav-menu.php | Returns the menu items associated with a particular object. |
| wp_update_nav_menu_item() wp-includes/nav-menu.php | Saves the properties of a menu item or create a new one. |
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/is_nav_menu_item