WPDev.one
Core Function
View Source on Trac ↗

wp_get_associated_nav_menu_items()

wp_get_associated_nav_menu_items( mixed $object_id = 0, mixed $object_type = 'post_type', mixed $taxonomy = '' )

Returns the menu items associated with a particular object.

Parameters 2 required

Name / Type Description
$object_id
int

Optional. The ID of the original object. Default 0.

string

$object_type Optional. The type of object, such as 'post_type' or 'taxonomy'. Default 'post_type'.

Required
string

$taxonomy Optional. If $object_type is 'taxonomy', $taxonomy is the name of the tax that $object_id belongs to. Default empty.

Required

Return Value

(int[])
The array of menu item IDs; empty array if none.

Function Information

Since Version
3.0.0
Source File
wp-includes/nav-menu.php
Advertisement