[wp-trac] [WordPress Trac] #32629: Introduce filter for wp_get_nav_menu_object() (was: Introduce pre_get_term filter)
WordPress Trac
noreply at wordpress.org
Sun Jun 14 05:45:00 UTC 2015
#32629: Introduce filter for wp_get_nav_menu_object()
-----------------------------+---------------------------
Reporter: westonruter | Owner: boonebgorges
Type: feature request | Status: reviewing
Priority: normal | Milestone: 4.3
Component: Menus | Version: 2.3
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+---------------------------
Changes (by westonruter):
* component: Taxonomy => Menus
Old description:
> For Menu Customizer (#32576) we need a filter which can intercept calls
> to `get_term()` to supply with the pending `nav_menu` term that is
> currently being previewed. I suggest a `pre_get_term` filter. This can be
> seen in action in the Menu Customizer plugin:
> [https://github.com/voldemortensen/menu-
> customizer/blob/981c82cad7effd1c8bb84ded0c1cc04f204e74cb/class-wp-
> customize-nav-menu-setting.php#L202-L283 class-wp-customize-nav-menu-
> setting.php]. See attached for patch.
New description:
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: [https://github.com/voldemortensen/menu-
customizer/blob/3738806e6851cffb059d311677e214bb99d94c15/class-wp-
customize-nav-menu-setting.php#L196-L249 class-wp-customize-nav-menu-
setting.php]. See attached for patch.
--
Comment:
Replying to [comment:2 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 [attachment:32629.2.diff].
Changes applied to Menu Customizer: [https://github.com/voldemortensen
/menu-customizer/commit/3738806e6851cffb059d311677e214bb99d94c15 3738806e]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32629#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list