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

Somewhere in my code I need to know what is the current language and display a certain custom field or another one based on this knowledge.

How can I know this information ?

share|improve this question
wpml.org/documentation – John P Bloch Jun 30 '11 at 20:54
Yes it was there : wpml.org/documentation/support/wpml-coding-api – Mike Jun 30 '11 at 22:33
up vote 4 down vote accepted

WPML defines constants that you can use go get the current language:

  • ICL_LANGUAGE_CODE - current language code (eg: en,fr,sp).
  • ICL_LANGUAGE_NAME_EN - Name of the current language in English (eg: English, French. Spanish).
  • ICL_LANGUAGE_NAME - Name of current language, in the current language (eg: English, Français, Español).
share|improve this answer
Thank you Bainternet – Mike Jul 2 '11 at 10:18

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.