Make WordPress Core

Opened 14 years ago

Last modified 5 years ago

#14439 new defect (bug)

Unable to get a post associated menu items for a specific menu

Reported by: dreadlox's profile DreadLox Owned by:
Milestone: Priority: normal
Severity: major Version: 3.1
Component: Menus Keywords: has-patch needs-refresh
Focuses: Cc:



The actual wp_get_associated_nav_menu_items function works well but gets menu items associated with an object from ANY menu. So a parameter needs to be added to specify a specific menu to get menu items associated with an object from a specific menu.

Patch is attached. The use of get_term() is needed because of the bug #14438

Attachments (2)

nav_menu.patch (1.5 KB) - added by DreadLox 14 years ago.
Patch to solve the bug
14439.patch (3.9 KB) - added by tyxla 9 years ago.
Refreshing and improving the patch, adding unit tests

Download all attachments as: .zip

Change History (7)

14 years ago

Patch to solve the bug

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to Future Release

Clever fix. Ultimately, you can do post-processing on this for now to fetch the menus for which the the meta items are assigned.

#2 @DreadLox
13 years ago

  • Keywords has-patch added
  • Version set to 3.1

Any reason that 6 months old patch hasn't made it's way to 3.1 ?

#3 @chriscct7
10 years ago

  • Keywords needs-refresh added; has-patch removed

9 years ago

Refreshing and improving the patch, adding unit tests

#4 @tyxla
9 years ago

  • Keywords has-patch added; needs-refresh removed

This can be useful in some situations, so I believe it should go into the core.

I've just refreshed the patch. The new patch is compatible with the latest function version (a $taxonomy parameter was added in #15264), and in addition to the previous patch takes care of the following:

  • Check for invalid menu ID
  • Updated documentation
  • Unit test case for correct usage of the new $menu_id parameter.
  • Unit test case for incorrect usage of the new $menu_id parameter.

#5 @wonderboymusic
8 years ago

  • Keywords needs-refresh added

patch doesn't apply

Note: See TracTickets for help on using tickets.