WP_HTML_Decoder::decode_text_node()public staticWP 6.6.0

Returns a string containing the decoded value of a given HTML text node.

Text nodes appear in HTML DATA sections, which are the text segments inside and around tags, excepting SCRIPT and STYLE elements (and some others), whose inner text is not decoded. Use this function to read the decoded value of such a text span in an HTML document.

Example:

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

Method of the class: WP_HTML_Decoder{}

No Hooks.

Return

String. Decoded UTF-8 value of given text node.

Usage

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

Changelog

Since 6.6.0 Introduced.

WP_HTML_Decoder::decode_text_node() code WP 6.6.2

public static function decode_text_node( $text ) {
	return static::decode( 'data', $text );
}