maybe_hash_hex_color( string $color ): string

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() .


Top ↑

Parameters

$color string Required

Top ↑

Return

string


Top ↑

Source

File: wp-includes/formatting.php. View all references

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

	return $color;
}


Top ↑

Changelog

Changelog
Version Description
3.4.0 Introduced.

Top ↑

User Contributed Notes

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