[wp-trac] [WordPress Trac] #49500: WordPress 5.4 messes up custom fields added to menu items they are duplicated.
WordPress Trac
noreply at wordpress.org
Thu Mar 26 14:42:01 UTC 2020
#49500: WordPress 5.4 messes up custom fields added to menu items they are
duplicated.
--------------------------+-------------------------
Reporter: BackuPs | Owner: audrasjb
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Menus | Version: trunk
Severity: normal | Resolution: worksforme
Keywords: | Focuses:
--------------------------+-------------------------
Comment (by BackuPs):
Replying to [comment:15 helgatheviking]:
> @BackuPs if you do this:
>
> >Actually the solution is even simpeler. I will just rename my
add_action and do_action in which case i dont have to check for the
wp_version.
>
> Then you might ''recreate'' the issue that this hook was meant to
solve... single Walker and fields from competing Walkers not displaying.
I've seen plenty of themes using the menu Walker and people contacting me
thinking my plugin wasn't working since my fields didn't display. having
this hook as a community hook as greatly reduced that and getting it in to
core should make it go away entirely.... assuming all theme/plugin devs do
a version check and stop switching the Walker as of WP 5.4.
>
> Something like this should do it and it's what I'll be adding to my
plugin soon.
>
> {{{
> global $wp_version;
> if( ! version_compare( $wp_version, '5.4-RC4', '>=' ) ) {
> add_filter( 'wp_edit_nav_menu_walker',
'helga_switch_nav_menu_walker' );
> }
> }}}
I am sorry but your code used is not save !
it should be like this as it should work on any wp version not only beta.
{{{
if (version_compare(preg_replace("/[^0-9\.]/","",$wp_version), '5.4', '<')
) {
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49500#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list