A WordPress-centric search engine for devs and theme authors



maybe_hash_hex_color ›

Since3.4.0
Deprecatedn/a
maybe_hash_hex_color ( $color )
Parameters:
  • (string) $color
    Required: Yes
Returns:
  • (string)
Defined at:
Codex:

Ensures that any hex color is properly hashed.

Otherwise, returns value untouched.

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



Source

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

	return $color;
}