Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
_nav_menu_item_id_use_once() WordPress Function
The nav_menu_item_id_use_once() function is used to check if a given menu item ID is currently in use. This can be useful when you need to make sure that a given menu item is only used once.
_nav_menu_item_id_use_once( string $id, object $item ) #
Prevents a menu item ID from being used more than once.
Contents
Parameters
- $id
(string)(Required)
- $item
(object)(Required)
Return
(string)
Source
File: wp-includes/nav-menu-template.php
function _nav_menu_item_id_use_once( $id, $item ) { static $_used_ids = array(); if ( in_array( $item->ID, $_used_ids, true ) ) { return ''; } $_used_ids[] = $item->ID; return $id; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
3.0.1 | Introduced. |