_nav_menu_item_id_use_once( string $id, object $item )

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


Parameters

$id

(string) (Required)

$item

(object) (Required)


Top ↑

Return

(string)


Top ↑

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

Top ↑

Changelog

Changelog
Version Description
3.0.1 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.