From ae0212699a4790ed6e2d8bfc426698d28f862a9e Mon Sep 17 00:00:00 2001 From: koopersmith Date: Fri, 25 May 2012 20:58:49 +0000 Subject: [PATCH] Theme Customizer: Allow sanitize_hexcolor to accept the empty string. Fixes default assignment on save and bug where header textcolor would remain hidden if loaded hidden. see #19910. git-svn-id: http://core.svn.wordpress.org/trunk@20915 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 8cf6d860b..f9698984e 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -860,8 +860,8 @@ function sanitize_header_textcolor( $color ) { function sanitize_hexcolor( $color ) { $color = preg_replace( '/[^0-9a-fA-F]/', '', $color ); - // 3 or 6 hex digits. - if ( preg_match('|^([A-Fa-f0-9]{3}){1,2}$|', $color ) ) + // 3 or 6 hex digits, or the empty string. + if ( preg_match('|^([A-Fa-f0-9]{3}){0,2}$|', $color ) ) return $color; return null;