Opened 10 years ago
Closed 10 years ago
#32629 closed feature request (fixed)
Introduce filter for wp_get_nav_menu_object()
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 2.3 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description (last modified by )
For Menu Customizer (#32576) we need a filter which can filter the return value for wp_get_nav_menu_object()
to supply with the pending nav_menu
term that is currently being previewed. This can be seen in action in the Menu Customizer plugin: class-wp-customize-nav-menu-setting.php. See attached for patch.
Attachments (2)
Change History (8)
#1
@
10 years ago
- Keywords has-patch added
- Owner set to boonebgorges
- Status changed from new to reviewing
#2
follow-up:
↓ 4
@
10 years ago
A bypass filter for get_term()
is a very powerful tool. I'm concerned that (a) it's liable to be misused, and (b) if we introduce such a filter here, we'll be asked for similar filters elsewhere in the taxonomy component (wp_update_term()
, get_terms()
, etc) as well as for objects like posts.
Looking at how you're using the filter, it seems like a filter on the return value of wp_get_nav_menu_object()
would actually work better for your purposes. Does that seem right?
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
10 years ago
@
10 years ago
Diff from previous patch: https://github.com/xwp/wordpress-develop/commit/4f1adc980fb0077b3f5cc71a6fc2d1e273926f95
#4
in reply to:
↑ 2
@
10 years ago
- Component changed from Taxonomy to Menus
- Description modified (diff)
- Summary changed from Introduce pre_get_term filter to Introduce filter for wp_get_nav_menu_object()
Replying to boonebgorges:
Looking at how you're using the filter, it seems like a filter on the return value of
wp_get_nav_menu_object()
would actually work better for your purposes. Does that seem right?
Good call. It seems to work fine if the filter is moved higher in the stack, to wp_get_nav_menu_object()
. See 32629.2.diff.
Changes applied to Menu Customizer: 3738806e
Source: https://github.com/xwp/wordpress-develop/pull/91/files#diff-f8b8f48c1d0c59e99b231fc7edeada87