Used By
Used By | Description |
---|---|
wp-includes/rest-api.php: rest_validate_value_from_schema() | Validate a value based on a schema. |
Parses a 3 or 6 digit hex color (with #).
(string) (Required) 3 or 6 digit hex color (with #).
(string|false)
File: wp-includes/rest-api.php
function rest_parse_hex_color( $color ) { $regex = '|^#([A-Fa-f0-9]{3}){1,2}$|'; if ( ! preg_match( $regex, $color, $matches ) ) { return false; } return $color; }
Version | Description |
---|---|
5.4.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/rest_parse_hex_color