WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The second parameter in the translate function is optional, but I always see people use it and some don't.

So I want to know if I should use it or not and if yes, how I will use it later.

I asking this because I'm new to this, and I'm using e() and _() right now in my theme, and I'll learn how to translate it when I finish.

Thanks in advance

share|improve this question
up vote 3 down vote accepted

Welcome to WPSE Peter,

The second argument is a translation domain. This is essentially where the translation for the first argument can be found. By default it checks the WordPress language folder - but if you are creating a custom theme or plug-in, you cannot rely on the translation for that string to be there (after all the WordPress language folders only contain translations for WordPress, not your plug-in/theme).

The setup is different for plug-ins, but to register a text domain for themes you use load_theme_textdomain:

add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
    load_theme_textdomain('my-unique-theme-domain', get_template_directory() . '/languages');

The first argument is the domain name, which is passed as the second argument in _e() and __(). The second is where the translation files can be found.

See Codex for _e() and __().

share|improve this answer
thank you very much – Pierre Mar 24 '12 at 11:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.