_e( string $text, string $domain = 'default' )

Display translated text.


Description Description


Parameters Parameters

$text

(string) (Required) Text to translate.

$domain

(string) (Optional) Text domain. Unique identifier for retrieving translated strings.

Default value: 'default'


Top ↑

Source Source

File: wp-includes/l10n.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 3 content
    Contributed by McContax
    _e( string $text, string $domain = 'default' )

    In this function,the “$domain” is used to locate the multilingual file.(The file which is the translation of your theme.)
    In wp-include there is a function related to this var

    function load_theme_textdomain( $domain, $path = false ) {
    $locale = apply_filters( 'theme_locale', get_locale(), $domain );
     
    if ( ! $path )
    $path = get_template_directory();
     
    // Load the textdomain from the Theme provided location, or theme directory first
    $mofile = "{$path}/{$locale}.mo";
    if ( $loaded = load_textdomain($domain, $mofile) )
    return $loaded;
     
    // Else, load textdomain from the Language directory
    $mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
    return load_textdomain($domain, $mofile);
    }

    You can see $domain is used in this file.Actually it’s used to locate the .mo file.So you must may sure it share the same name with your theme folder name

You must log in before being able to contribute a note or feedback.