[wp-trac] [WordPress Trac] #43113: Multiple custom item classes are returned as single string when using 'nav_menu_link_attributes' filter with Customizer preview

WordPress Trac noreply at wordpress.org
Tue Nov 17 04:29:18 UTC 2020


#43113: Multiple custom item classes are returned as single string when using
'nav_menu_link_attributes' filter with Customizer preview
---------------------------------------------+-------------------------
 Reporter:  lrdn                             |       Owner:  noisysocks
     Type:  defect (bug)                     |      Status:  closed
 Priority:  normal                           |   Milestone:  5.6
Component:  Customize                        |     Version:  4.3
 Severity:  normal                           |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests commit  |     Focuses:
---------------------------------------------+-------------------------
Changes (by noisysocks):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"49624" 49624]:
 {{{
 #!CommitTicketReference repository="" revision="49624"
 Customize: Ensure multiple CSS classes are passed to
 nav_menu_link_attributes as an array

 When multiple CSS classes are added to a menu item, the
 nav_menu_link_attributes
 filter should be called with $item->classes set to an array of CSS class
 names.

 When previewing in the Customizer, however, a single string was being
 passed to
 $item->classes because WP_Customize_Nav_Menu_Item_Setting::preview()
 bypasses
 wp_update_nav_menu_item() and instead uses filter_wp_get_nav_menu_items().

 The fix is to make filter_wp_get_nav_menu_items() match what
 wp_update_nav_menu_item() does and split the string into an array.

 Fixes #43113.
 Props dlh.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43113#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list