Opened 9 years ago
Closed 9 years ago
#39849 closed defect (bug) (fixed)
Filter `nav_menu_items_{$post_type_name}_recent` passes base args, not recent
| Reported by: | eclev91 | Owned by: | welcher |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.9 |
| Component: | Menus | Version: | 4.7.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: | administration |
Description
On line 434 of nav-menu.php, the nav_menu_items_{$post_type_name}_recent filter is passing the base $args rather than the adjusted $recent_args set on line 418. Could be expected, but seemed odd to me and I ended up reapplying those arguments in my filter function.
If someone can confirm this is a bug and not as expected, I'd be happy to attach a patch.
Attachments (2)
Change History (9)
This ticket was mentioned in Slack in #core by welcher. View the logs.
9 years ago
#3
follow-up:
↓ 4
@
9 years ago
@eclev91 I've added an initial patch and @johnbillion reviewed it with me.
The concern with my approach is that $args['walker'] is overridden after the array merge and doesn't exist in the $recent_args array. We both agreed that it may be better to add a fourth argument to the filter that holds $recent_args instead.
#4
in reply to: ↑ 3
@
9 years ago
While it's been a while since I ran into this, I think the proposed solution makes sense. As long as those arguments are available and how to get them is documented.
#5
@
9 years ago
- Keywords has-patch added; needs-patch removed
- Milestone Awaiting Review → 4.9
- Owner set to
- Status new → assigned
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
@eclev91 thanks for reporting!
This does seem unexpected to me as well. It seems to me that the filter should have all of the args available to it.