esc_html
Filters a string cleaned and escaped for output in HTML.
Text passed to esc_html() is stripped of invalid or special characters before output.
Usage
add_filter( 'esc_html', 'wp_kama_esc_html_filter', 10, 2 );
/**
* Function for `esc_html` 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_html_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 2.8.0 | Introduced. |
Where the hook is called
esc_html
wp-includes/formatting.php 4687
return apply_filters( 'esc_html', $safe_text, $text );