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.


Top ↑

Return

(bool) Whether the given ID is that of a nav menu item.


Top ↑

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


Top ↑

Changelog

Changelog
VersionDescription
3.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.