Make WordPress Core

Opened 16 years ago

Last modified 2 months ago

#14439 new defect (bug)

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

Reported by: DreadLox Owned by:
Priority: normal Milestone:
Component: Menus Version: 3.1
Severity: major Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

Hello,

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 16 years ago.
Patch to solve the bug
14439.patch​ (3.9 KB ) - added by tyxla 12 years ago.
Refreshing and improving the patch, adding unit tests

Download all attachments as: .zip

Change History (8)

@DreadLox
16 years ago

Patch to solve the bug

#1 @nacin
16 years ago

  • Milestone Awaiting Review → 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
16 years ago

  • Keywords has-patch added
  • Version → 3.1

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

#3 @chriscct7
12 years ago

  • Keywords needs-refresh added; has-patch removed

@tyxla
12 years ago

Refreshing and improving the patch, adding unit tests

#4 @tyxla
12 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
11 years ago

  • Keywords needs-refresh added

patch doesn't apply

This ticket was mentioned in ​PR #12956 on ​WordPress/wordpress-develop by ​skikken.


2 months ago
#6

  • Keywords has-unit-tests added; needs-refresh removed

Trac ticket: https://core.trac.wordpress.org/ticket/14439

## Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): Sonnet
Used for: Writing test cases

Note: See TracTickets for help on using tickets.