Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13916 closed defect (bug) (wontfix)

$args not passed to wp_get_nav_menu_items in wp_nav_menu function

Reported by: DreadLox Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Menus Keywords: has-patch
Focuses: Cc:



With the recent implementation of wp_get_nav_menu_items filter ([13858]) , arguments passed to wp_nav_menu are not passed to wp_get_nav_menu_items and thus it prevents from passing additional arguments like a child_of argument to get a portion of a menu.

Attachments (1)

patch.txt (1.0 KB) - added by DreadLox 5 years ago.
Patch to correct the bug

Download all attachments as: .zip

Change History (8)

5 years ago

Patch to correct the bug

#1 @DreadLox
5 years ago

  • Keywords has-patch added

#2 @filosofo
5 years ago

But the arguments are different: those for wp_get_nav_menu_items mostly have to do with the status and order of the menu items; those for wp_nav_menu mostly have to do with its markup.

#3 @filosofo
5 years ago

  • Milestone changed from 3.0 to 3.1
  • Priority changed from high to normal
  • Severity changed from major to normal
  • Version set to 3.0

And this is not a major issue or one that needs to go into 3.0.

#4 @DreadLox
5 years ago

I understand that.Thus there is no way to pass args to wp_get_nav_menu_items filter witch makes it useless.

I have one menu. On the top bar, I display it using depth=1 (so it displays the first level) then I have an other one in the side bar. For the last, I get the current page ancestor ID and pass it to wp_nav_menu to get only that submenu.

As it is now, I have no way to do that. Maybe you do ?

#5 @filosofo
5 years ago

I think I would take another approach, but if I had to work with that I would set a global variable that let me know whether the current call to wp_get_nav_menu_items were in the sidebar, and then check that global variable within the callback attached to the wp_get_nav_menu_items filter.

#6 @DreadLox
5 years ago

It is an uggly hack but it could do the trick. Thks.

#7 @nacin
5 years ago

  • Milestone Awaiting Triage deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.