Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Bjarne Benner 8 years, 5 months ago.

Assigned support staff: Andreas Neuber.

Author Posts
October 9, 2012 at 12:46 pm #78953

Bjarne Benner

Is it possible to get the language code for a specific post ID?
I'm using this in a plugin, and the post is not necessarily for the current language.

October 9, 2012 at 1:47 pm #78967

Andreas Neuber

Languages: English (English ) German (Deutsch )

Dear Bjarne,

You could use function "wpml_get_language_information()" located in "sitepress-multilingual-cms/inc/template-functions.php" ~ line 441


	$info = wpml_get_language_information($post_id);
	echo "<pre>";
	echo "</pre>";

$info['locale'] will provide you with the language code.

Would this work for you?

October 11, 2012 at 12:03 pm #79281

Bjarne Benner

Yes, thank you!

October 29, 2012 at 7:26 am #82211

Bjarne Benner

Hi, this thread can be closed. Thank you for your help.

November 13, 2012 at 7:44 am #84205

Bjarne Benner

Hi, I keep getting emails asking me to mark this thread as resolved. How can I stop them?

The topic ‘[Closed] How to get the language code for a post ID?’ is closed to new replies.