WordPress开发者和主题制作者的搜索引擎



maybe_hash_hex_color ›

Since3.4.0
已弃用n/a
maybe_hash_hex_color ( $color )
参数:
  • (string) $color
    Required: Yes
返回:
  • (string)
定义在:
文档:

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



源码

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

	return $color;
}