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. Built from https://develop.svn.wordpress.org/trunk@49624 git-svn-id: http://core.svn.wordpress.org/trunk@49362 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fb2f5a743b
commit
a3c8b3ddea
|
@ -605,6 +605,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting {
|
|||
$item->post_title = $item->title;
|
||||
}
|
||||
|
||||
// 'classes' should be an array, as in wp_setup_nav_menu_item().
|
||||
if ( isset( $item->classes ) && is_scalar( $item->classes ) ) {
|
||||
$item->classes = explode( ' ', $item->classes );
|
||||
}
|
||||
|
||||
$item->ID = $this->post_id;
|
||||
$item->db_id = $this->post_id;
|
||||
$post = new WP_Post( (object) $item );
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.6-beta4-49623';
|
||||
$wp_version = '5.6-beta4-49624';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue