Astra_Customizer_Sanitizes::sanitize_hex_color( string $color )

Sanitize HEX color


Description


Parameters

$color

(string) (Required) setting input.


Return

(string) setting input value.


Source

File: inc/customizer/class-astra-customizer-sanitizes.php

		public static function sanitize_hex_color( $color ) {

			if ( '' === $color ) {
				return '';
			}

			// 3 or 6 hex digits, or the empty string.
			if ( preg_match( '|^#([A-Fa-f0-9]{3}){1,2}$|', $color ) ) {
				return $color;
			}

			return '';
		}


User Contributed Notes

You must log in before being able to contribute a note or feedback.