esc_xml
Filters a string cleaned and escaped for output in XML.
Text passed to esc_xml() is stripped of invalid or special characters before output. HTML named character references are converted to their equivalent code points.
Usage
add_filter( 'esc_xml', 'wp_kama_esc_xml_filter', 10, 2 );
/**
* Function for `esc_xml` filter-hook.
*
* @param string $safe_text The text after it has been escaped.
* @param string $text The text prior to being escaped.
*
* @return string
*/
function wp_kama_esc_xml_filter( $safe_text, $text ){
// filter...
return $safe_text;
}
- $safe_text(string)
- The text after it has been escaped.
- $text(string)
- The text prior to being escaped.
Changelog
| Since 5.5.0 | Introduced. |
Where the hook is called
esc_xml
wp-includes/formatting.php 4806
return apply_filters( 'esc_xml', $safe_text, $text );