[wp-trac] [WordPress Trac] #47056: Add 'wp_nav_menu_item_custom_fields' hook in Walker_Nav_Menu_Edit::start_el()
WordPress Trac
noreply at wordpress.org
Mon May 6 20:54:16 UTC 2019
#47056: Add 'wp_nav_menu_item_custom_fields' hook in
Walker_Nav_Menu_Edit::start_el()
------------------------------------+------------------------------
Reporter: MikeSchinkel | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Menus | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch dev-feedback | Focuses:
------------------------------------+------------------------------
Comment (by MikeSchinkel):
Per @desrosj at the 2019 WCATL contributor day event I did some research
to find out how many current WordPress plugins are:
1. Extending `Walker_Nav_Menu_Edit`
2. Replacing `Walker_Nav_Menu_Edit` by using a `'wp_edit_nav_menu_walker'`
hook
3. **Already implementing a `'wp_nav_menu_item_custom_fields'` hook**
Based on [https://github.com/newclarity/wp-plugin-downloader downloading]
of all of the latest versions of plugins from the WordPress repo I have
come up with the following metrics:
1. `72` plugins extend `Walker_Nav_Menu_Edit`
2. `156` plugins use the `'wp_edit_nav_menu_walker'` hook
3. `60` already implement the `'wp_nav_menu_item_custom_fields'` hook
I am attaching the files where I got these numbers.
Here are links to gists of the raw data:
1. [https://gist.github.com/mikeschinkel/6973230dc12899d3bd909ef2d3949974
Extends `Walker_Nav_Menu_Edit`]
2. [https://gist.github.com/mikeschinkel/6e6e26a01e4f34554b43269f3ab10ad7
Uses the `'wp_edit_nav_menu_walker'` hook]
3. [https://gist.github.com/mikeschinkel/81e02a427c2faabb5556b0524b33a8f5
Implements the `'wp_nav_menu_item_custom_fields'` hook]
The problems replacing `Walker_Nav_Menu_Edit` causes is that it ensures no
two plugins that do so can be used together — with some obvious caveats,
but those do not change the fundamental problem.
I think it is reasonable to assume that if someone is downloading plugins
to enhance their menus chances are there are trying to use more than one
such plugin. The fact that these plugins are mutually exclusive means that
all those people will run into incompatibilities, and ones they are likely
not even be able to understand what is going wrong. This seems destined to
ensure a bad UX which is the opposite of the WordPress ethos.
Since the primary concern that @desrosj mentioned to not add this hook is
the potential for issues, it would seem that so much use in-the-wild
proves that the hook can be used without ''(at least existing)'' issues.
And adding the hook can eliminate the incompatibility between any of
plugins that update to use the new hook instead of still replacing
`Walker_Nav_Menu_Edit`.
So I am hoping that makes [/attachment/ticket/47056/47056.patch this
patch] a no-brainer?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47056#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list