WP_HTML_Decoder::decode_attribute()public staticWP 6.6.0

Returns a string containing the decoded value of a given HTML attribute.

Text found inside an HTML attribute has different parsing rules than for text found inside other markup, or DATA segments. Use this function to read the decoded value of an HTML string inside a quoted attribute.

Example:

'“😄”' === WP_HTML_Decode::decode_attribute( '“😄”' );

Method of the class: WP_HTML_Decoder{}

No Hooks.

Return

String. Decoded UTF-8 value of given attribute value.

Usage

$result = WP_HTML_Decoder::decode_attribute( $text );
$text(string) (required)
Text containing raw and non-decoded attribute value to decode.

Changelog

Since 6.6.0 Introduced.

WP_HTML_Decoder::decode_attribute() code WP 6.6.2

public static function decode_attribute( $text ) {
	return static::decode( 'attribute', $text );
}