maybe_hash_hex_color( string $color )

Ensures that any hex color is properly hashed.


Description

Otherwise, returns value untouched.

This method should only be necessary if using sanitize_hex_color_no_hash().


Parameters

$color

(string) (Required)


Return

(string)


Source

File: wp-includes/formatting.php

function maybe_hash_hex_color( $color ) {
	if ( $unhashed = sanitize_hex_color_no_hash( $color ) ) {
		return '#' . $unhashed;
	}

	return $color;
}


Changelog

Changelog
Version Description
WP-3.4.0 Introduced.