Opened 8 years ago
Closed 7 years ago
#39849 closed defect (bug) (fixed)
Filter `nav_menu_items_{$post_type_name}_recent` passes base args, not recent
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.7.2 |
Component: | Menus | Keywords: | has-patch |
Focuses: | administration | Cc: |
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.
8 years ago
#3
follow-up:
↓ 4
@
8 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.
Would you like to apply those changes?
#4
in reply to:
↑ 3
@
8 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
@
7 years ago
- Keywords has-patch added; needs-patch removed
- Milestone changed from Awaiting Review to 4.9
- Owner set to welcher
- Status changed from new to assigned
@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.