From 5a53ce6d284bf023ca3194054c44bbce6571031c Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 23 May 2012 15:36:27 +0000 Subject: [PATCH] Translate and empty header text color into the default text color. Honor blank. Props kovshenin. fixes #20600 git-svn-id: http://core.svn.wordpress.org/trunk@20851 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-customize.php b/wp-includes/class-wp-customize.php index ba6dfed89..2ba1f1b93 100644 --- a/wp-includes/class-wp-customize.php +++ b/wp-includes/class-wp-customize.php @@ -564,8 +564,7 @@ final class WP_Customize { ) ); $this->add_setting( 'header_textcolor', array( - // @todo: replace with a new accept() setting method - // 'sanitize_callback' => 'sanitize_hexcolor', + 'sanitize_callback' => 'sanitize_header_textcolor', 'theme_supports' => array( 'custom-header', 'header-text' ), 'default' => get_theme_support( 'custom-header', 'default-text-color' ), ) ); @@ -793,6 +792,17 @@ final class WP_Customize { } }; +// Callback function for sanitizing the header textcolor setting. +function sanitize_header_textcolor( $color ) { + if ( empty( $color ) ) + return get_theme_support( 'custom-header', 'default-text-color' ); + + elseif ( $color == 'blank' ) + return 'blank'; + + return sanitize_hexcolor( $color ); +} + // Callback function for sanitizing a hex color function sanitize_hexcolor( $color ) { $color = preg_replace( '/[^0-9a-fA-F]/', '', $color );