3

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 ?

4

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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