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

I'm using WordPress MultiLanguage Plugin and I want to know what is the language of a specific element, page or post.

I do have the id but I want to obtain the language.

share|improve this question

From The WPML website:


Language constants

WPML defines the following constants which can be used in the theme:

Constant              Description                                        Example

ICL_LANGUAGE_CODE     Code for the current language                      fr
ICL_LANGUAGE_NAME     Name of current language, in the current language  Français
ICL_LANGUAGE_NAME_EN  Name of the current language name in English       French
share|improve this answer
It's about page language, not the language supported and i don't need this in the theme, I need this inside a plugin. – sorin Oct 4 '10 at 9:24
Those constants are defined at priority 1 on the 'plugins_loaded' action, using the current url's language code. I promise you, that's what you want. – John P Bloch Oct 4 '10 at 13:47

To get the language of a specific post or page, you can use wpml_get_language_information(). This returns an array with the following indexes:

  • locale
  • text_direction
  • display_name
  • native_name
  • different_language


$language_information = wpml_get_language_information($post_id);
$locale = $language_information['locale'];

I have found this function via andreas.n on the WPML Forums.

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.