WP_HTML_Decoder::decode_text_node( string $text ): string

In this article

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

Description

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( '“😄&#x94' );

Parameters

$textstringrequired
Text containing raw and non-decoded text node to decode.

Return

string Decoded UTF-8 value of given text node.

Source

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

Changelog

VersionDescription
6.6.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.