WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wp_get_associated_nav_menu_items() WP 3.0.0

Get the menu items associated with a particular object.

Хуков нет.

Возвращает

Массив. The array of menu item IDs; empty array if none;

Использование

wp_get_associated_nav_menu_items( $object_id, $object_type, $taxonomy );
$object_id(число)
The ID of the original object.
По умолчанию: 0
$object_type(строка)
The type of object, such as "taxonomy" or "post_type."
По умолчанию: 'post_type'
$taxonomy(строка)
If $object_type is "taxonomy", $taxonomy is the name of the tax that $object_id belongs to
По умолчанию: ''

Список изменений

С версии 3.0.0 Введена.

Код wp get associated nav menu items: wp-includes/nav-menu.php WP 5.2.3

<?php
function wp_get_associated_nav_menu_items( $object_id = 0, $object_type = 'post_type', $taxonomy = '' ) {
	$object_id     = (int) $object_id;
	$menu_item_ids = array();

	$query      = new WP_Query;
	$menu_items = $query->query(
		array(
			'meta_key'       => '_menu_item_object_id',
			'meta_value'     => $object_id,
			'post_status'    => 'any',
			'post_type'      => 'nav_menu_item',
			'posts_per_page' => -1,
		)
	);
	foreach ( (array) $menu_items as $menu_item ) {
		if ( isset( $menu_item->ID ) && is_nav_menu_item( $menu_item->ID ) ) {
			$menu_item_type = get_post_meta( $menu_item->ID, '_menu_item_type', true );
			if (
				'post_type' == $object_type &&
				'post_type' == $menu_item_type
			) {
				$menu_item_ids[] = (int) $menu_item->ID;
			} elseif (
				'taxonomy' == $object_type &&
				'taxonomy' == $menu_item_type &&
				get_post_meta( $menu_item->ID, '_menu_item_object', true ) == $taxonomy
			) {
				$menu_item_ids[] = (int) $menu_item->ID;
			}
		}
	}

	return array_unique( $menu_item_ids );
}