htmlentities2()
Converts entities, while preserving already-encoded entities.
No Hooks.
Return
String
. Converted text.
Usage
htmlentities2( $text );
- $text(string) (required)
- The text to be converted.
Changelog
Since 1.2.2 | Introduced. |
htmlentities2() htmlentities2 code WP 6.7.1
function htmlentities2( $text ) { $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( $text, $translation_table ) ); }