wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



maybe_hash_hex_color › WordPress Function

Depuis3.4.0
Dépréciéen/a
maybe_hash_hex_color ( $color )
Paramètres:
  • (string) $color
    Requis: Oui
Retourne:
  • (string)
Défini(e) dans:
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 ) {
	$unhashed = sanitize_hex_color_no_hash( $color );
	if ( $unhashed ) {
		return '#' . $unhashed;
	}

	return $color;
}