Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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.

Our next available supporter will start replying to tickets in about 9.68 hours from now. Thank you for your understanding.

This topic contains 3 replies, has 2 voices.

Last updated by Andreas Neuber 6 years, 10 months ago.

Assigned support staff: Andreas Neuber.

Author Posts
January 25, 2013 at 3:52 pm #99414

Ad Label


I am having trouble in trying to change the language in my code , just like this thread:

I have trien following the stepf here but no luck. Here's my code:

add_action('after_setup_theme', 'my_icl_set_current_language');

function my_icl_set_current_language() {
$lang = $_GET['lang'];
global $sitepress;

The ICL_LANGUAGE_CODE constant never changes to the desired language.

Can you please provide some help?

Thanks in advance,


January 25, 2013 at 5:20 pm #99455

Andreas Neuber

Languages: English (English ) German (Deutsch )

Hello AdLabel,

The code looks altogether correct. The constant ICL_LANGUAGE_CODE will have as its value the default language set.
So for your tests you would rather need to use a...


Do you need this function for AJAX?

January 29, 2013 at 4:50 pm #100271

Ad Label


Yes, this is to be used in ajax.

In your documentation it reads that ICL_LANGUAGE_CODE holds the current language, shouldn't it reflect the language we chose?

January 30, 2013 at 8:17 am #100401

Andreas Neuber

Languages: English (English ) German (Deutsch )

Hello AdLabel,

The problem here is that the value of constant ICL_LANGUAGE_CODE is set when the instance of the sitepress class is created. Or in other words, its value changes only with a new page call.


// part of SitePress class definition
    define('ICL_LANGUAGE_CODE', $this->this_lang);

However, with AJAX you are not calling the website new in the browser, just a part of it (the basic concept of AJAX).

The topic ‘[Closed] Change language programaticly’ is closed to new replies.