From ede4050aced9f8dfe4ba6fd8f5e56a70b8056df6 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Tue, 20 Oct 2015 22:44:44 +0000 Subject: [PATCH] Customizer: Prevent `nav_menu_item` settings from becoming dirty when their controls are set up. Since `wp_setup_nav_menu_item()` returns the `classes` property as an array but the Customizer manages the value as a string, the setting needs to initially export the value as a string. This prevents the `classes` property type change from causing the setting to get marked as dirty even though nothing changed. This is a regression from [34788]. See #34111. git-svn-id: https://develop.svn.wordpress.org/trunk@35308 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-setting.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-includes/class-wp-customize-setting.php b/src/wp-includes/class-wp-customize-setting.php index c7cff51fe5..af850098ce 100644 --- a/src/wp-includes/class-wp-customize-setting.php +++ b/src/wp-includes/class-wp-customize-setting.php @@ -1151,6 +1151,11 @@ class WP_Customize_Nav_Menu_Item_Setting extends WP_Customize_Setting { $this->value[ $key ] = intval( $this->value[ $key ] ); } } + foreach ( array( 'classes', 'xfn' ) as $key ) { + if ( is_array( $this->value[ $key ] ) ) { + $this->value[ $key ] = implode( ' ', $this->value[ $key ] ); + } + } if ( ! isset( $this->value['_invalid'] ) ) { $this->value['_invalid'] = (