Uses
| Uses | Description |
|---|---|
| wp-includes/formatting.php: sanitize_hex_color_no_hash() | Sanitizes a hex color without a hash. Use sanitize_hex_color() when possible. |
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().
(string) (Required)
(string)
File: wp-includes/formatting.php
function maybe_hash_hex_color( $color ) {
$unhashed = sanitize_hex_color_no_hash( $color );
if ( $unhashed ) {
return '#' . $unhashed;
}
return $color;
} | Version | Description |
|---|---|
| 3.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/maybe_hash_hex_color