is_nav_menu_item

The timeline below displays how wordpress function is_nav_menu_item has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Determines whether the given ID is a nav menu item.
 *
 * @since 3.0.0
 *
 * @param int $menu_item_id The ID of the potential nav menu item.
 * @return bool Whether the given ID is that of a nav menu item.
 */
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);
}

WordPress Version: 4.5

/**
 * Determines whether the given ID is a nav menu item.
 *
 * @since 3.0.0
 *
 * @param int $menu_item_id The ID of the potential nav menu item.
 * @return bool Whether the given ID is that of a nav menu item.
 */
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);
}

WordPress Version: 3.7

/**
 * Determine whether the given ID is a nav menu item.
 *
 * @since 3.0.0
 *
 * @param int $menu_item_id The ID of the potential nav menu item.
 * @return bool Whether the given ID is that of a nav menu item.
 */
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);
}