_nav_menu_item_id_use_once()WP 3.0.1

Prevents a menu item ID from being used more than once.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Return

String.

Usage

_nav_menu_item_id_use_once( $id, $item );
$id(string) (required)
-
$item(object) (required)
-

Changelog

Since 3.0.1 Introduced.

_nav_menu_item_id_use_once() code WP 6.6.2

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