_e()WP 1.2.0

Display translation of the text using a translation file.

If there is no translation, or the text domain isn't loaded, the original text is returned.

To retrieve the translation for use in a variable, use a similar function __().

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.


null. Nothing (null). Display the result.


<?php _e( $text, $domain ); ?>
$text(string) (required)
Text to translate.
Translation file ID, specified during registration and connection of the translation file, see load_textdomain(). If not specified, the default WordPress translation file will be used.
Default: 'default'



#1 Make a string inside your plugin or theme translatable

<?php _e( 'Hello World', 'text_domain' ); ?>

Hello World and text_domain should always be directly passed as a string literal as shown above, not a string assigned to a variable.

This is incorrect:

$text_domain = 'text_domain';
$string = 'Hello World!';
_e( $string, $text_domain );

#2 Translate the string

Example of using the function in a basic WordPress theme:

<?php _e( 'Comment:' ); ?>

If Russian localization file is used, it will display: "Комментарий:".

Since version 4.2, the WPLANG constant has been canceled and now the language is changed in the main site settings.

Before WordPress 4.2: Russian localization file means that the WPLANG constant is defined as ru_RU in wp-config.php file: define('WPLANG', 'ru_RU');. For such a translation, without specifying a $domain, the default wp-content/languages/ru_RU.mo file will be used.


#3 String translation with specifying translation domain

To translate a string from own translation file, we need to specify second parameter $domain. It bind translation string to translation file. $domain and the translation file are registered with the load_textdomain() function;

<?php _e( 'Comment: ', 'mydomain' ); ?>

#4 Display translation

There is similar function __(), which returns the result, but not display it. For Example the following strings are the same:

_e( 'this is some message', 'text_domain' );

// is same as
echo __( 'this is a some message', 'text_domain' );


Since 1.2.0 Introduced.

_e() code WP 6.4.3

function _e( $text, $domain = 'default' ) {
	echo translate( $text, $domain );