Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/esc html 2

This page is named incorrectly due to a limitation of Mediawiki page naming.
The function name is esc_html__() not esc_html_2().


Retrieves the translation of $text and escapes it for safe use in HTML. If there is no translation, or the domain isn't loaded, the original text is returned.


<?php esc_html__$text$domain ?>


(string) (required) Text to translate.
Default: None
(string) (optional) Domain to retrieve the translated text.
Default: 'default'

Return Values

Translated and escaped text.

Change Log

Source File

esc_html__() is located in wp-includes/l10n.php.


L10n: translate(), __(), _e(), _n(), _x(), _ex(), _nx(), esc_attr__(), esc_attr_e(), esc_attr_x(), esc_html__(), esc_html_e(), esc_html_x(), _n_noop(), _nx_noop(), translate_nooped_plural()

See also index of Function Reference and index of Template Tags.