__() WordPress Function

The __() function is a WordPress core function that allows you to translate text within your WordPress site. This function takes two arguments: the text to be translated, and the text domain. The text domain is the unique identifier for a set of translated text strings. For example, if you were translating the WordPress core, the text domain would be "default".

__( string $text, string $domain = 'default' ) #

Retrieve the translation of $text.


Description

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


Top ↑

Parameters

$text

(string)(Required)Text to translate.

$domain

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

Default value: 'default'


Top ↑

Return

(string) Translated text.


Top ↑

Source

File: wp-includes/l10n.php

function __( $text, $domain = 'default' ) {
	return translate( $text, $domain );
}


Top ↑

Changelog

Changelog
VersionDescription
2.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by the Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.