htmlentities2() WordPress Function
The htmlentities2() function is a built-in function in WordPress that is used to convert all applicable characters to HTML entities. This function is similar to the htmlentities() function, with the only difference being that htmlentities2() also converts UTF-8 characters to HTML entities.
htmlentities2( string $myHTML ) #
Converts entities, while preserving already-encoded entities.
Contents
Parameters
- $myHTML
(string)(Required)The text to be converted.
Return
(string) Converted text.
Source
File: wp-includes/formatting.php
function htmlentities2( $myHTML ) { $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES ); $translation_table[ chr( 38 ) ] = '&'; return preg_replace( '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/', '&', strtr( $myHTML, $translation_table ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
1.2.2 | Introduced. |