[wp-trac] [WordPress Trac] #52694: Twenty Twenty-One: Primary menu toggle filter adds toggles to third party menu locations
WordPress Trac
noreply at wordpress.org
Mon Jun 3 12:42:14 UTC 2024
#52694: Twenty Twenty-One: Primary menu toggle filter adds toggles to third party
menu locations
-------------------------------------+---------------------
Reporter: domainsupport | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.6
Component: Bundled Theme | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+---------------------
Comment (by SergeyBiryukov):
Replying to [comment:16 SergeyBiryukov]:
> So I would rewrite the code in question like this
It appears that the `isset( $args->theme_location )` check is redundant
here, as it is one of the defaults in `wp_nav_menu()` and would always be
present. All of the filters attached to `walker_nav_menu_start_el` in
other bundled themes just check `$args->theme_location` directly, so the
same should be enough here:
> {{{
> if ( 'primary' === $args->theme_location
> && 0 === $depth && in_array( 'menu-item-has-children',
$item->classes, true )
> ) {
> }}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52694#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list