Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What's different between _x() and _(). For example: if a1 can translate as:

  • a1 has meaning x1;
  • a1 has meaning x2;

How _x() function to get value x1 or x2?

share|improve this question

1 Answer 1

_x() let's you add a context to your strings. This is useful when you are using the same string in different places. This string may need different translations depending on the language.

Your example would be :

echo 'a1 in context 1 ' . _x('a1', 'context1', 'mydomain');
echo 'a1 in context 2 ' . _x('a1', 'context2', 'mydomain');

There are more examples in this article.

share|improve this answer

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.