esc_html_x()
Translates string with gettext context, and escapes it for safe use in HTML output.
If there is no translation, or the text domain isn't loaded, the original text is escaped and returned.
No Hooks.
Return
String
. Translated text.
Usage
esc_html_x( $text, $context, $domain );
- $text(string) (required)
- Text to translate.
- $context(string) (required)
- Context information for the translators.
- $domain(string)
- Text domain. Unique identifier for retrieving translated strings.
Default: 'default'
Changelog
Since 2.9.0 | Introduced. |
esc_html_x() esc html x code WP 6.7.2
function esc_html_x( $text, $context, $domain = 'default' ) { return esc_html( translate_with_gettext_context( $text, $context, $domain ) ); }