WP_Customize_Manager::_sanitize_header_textcolor() WordPress Method

The WP_Customize_Manager::_sanitize_header_textcolor() method is used to sanitize the header text color value before it is saved to the database. This method ensures that the header text color is a valid hex color value.

WP_Customize_Manager::_sanitize_header_textcolor( string $color ) #

Callback for validating the header_textcolor value.


Description

Accepts ‘blank’, and otherwise uses sanitize_hex_color_no_hash(). Returns default text color if hex color is empty.


Top ↑

Parameters

$color

(string)(Required)


Top ↑

Return

(mixed)


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	public function _sanitize_header_textcolor( $color ) {
		if ( 'blank' === $color ) {
			return 'blank';
		}

		$color = sanitize_hex_color_no_hash( $color );
		if ( empty( $color ) ) {
			$color = get_theme_support( 'custom-header', 'default-text-color' );
		}

		return $color;
	}


Top ↑

Changelog

Changelog
VersionDescription
3.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More