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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: America/Los_Angeles (GMT-07:00)

Tagged: 

This topic contains 5 replies, has 1 voice.

Last updated by Bobby 1 month ago.

Assisted by: Bobby.

Author Posts
April 7, 2025 at 6:40 pm #16905698

abdelilahA

Background of the issue:
I am trying to set up WPML on my website. I've configured my WPML selector as I wished. When I try to switch between my translations (EN -> FR), the wp-wpml_current_language is not updated, or updated to the wrong language. Link to a page where the issue can be seen: hidden link. But, the translation is good (meaning, EN -> FR, the text turn french, but the Cookie and Class says it's en the current language).

Symptoms:
The current language is not updated (Cookie and CSS class). I've tried in private navigation and to clear my cache.

Questions:
Why is the wp-wpml_current_language not updating correctly?
How can I ensure the language switcher updates the current language as expected?

April 8, 2025 at 3:08 pm #16910144

Andrey
WPML Supporter since 06/2013

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+03:00)

While one of my teammates addresses your ticket, I will provide you with some initial debugging steps.

Does the same issue occur if you temporarily deactivate all plugins except for WPML?

When using your custom language switcher, I am unable to switch between languages. The language switcher only works once, and this does not show the issue. I recommend temporarily activating the default language in the footer (in WPML → Languages) to check if it resolves the problem.

Screenshot-2025-04-08-at-18-05-12.png
April 8, 2025 at 3:44 pm #16910262

abdelilahA

Hello Andrey, thank you for your response.

I've desactivated almost all of my plugins (only sitekit and elementor kept). And it doesn't solve the problem.

Also, I added the default switcher in the footer, but it suffers of the same problem : when I click to French, the page is translated, but the switch doesn't update the current language correctly.

Other ideas of how to debug this ?

Thank you.

April 9, 2025 at 2:06 am #16911209

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

When viewing the EN version I can see the language switcher at the bottom which then allows me to switch to FR or AR but then I cannot switch back to EN.

The source is showing OK in the EN, however, take a look at the FR source.

view-source:hidden link

it's not updating correctly, which is why the option to switch to EN is not showing.

<link rel="alternate" hreflang="en" href="hidden link">
<link rel="alternate" hreflang="fr" href="hidden link">
<link rel="alternate" hreflang="ar" href="hidden link">
<link rel="alternate" hreflang="x-default" href="hidden link">

I can see you are using a custom theme, Is it possible to test with the parent theme of Hello Elementor or a theme such as Twenty25? this will help us understand if the issue is originating from the theme's code or something else.

April 9, 2025 at 8:02 am #16911814

abdelilahA

Hi Bobby,

"When viewing the EN version I can see the language switcher at the bottom which then allows me to switch to FR or AR but then I cannot switch back to EN."
=> It's because the current_language item has a CSS on it that makes it white so it not visible (white on white), but it's there. The problem is that the current_language does not switch to french so the 'English' selector stays not visible.

The hrelfang is also showing in hidden link on my side (I don't what you mean by it's not updating correctly).

I tested with HelloElementor not custom, and it acted the same (I can't let it with that theme unfortunately).

I also used the troubleshooting page to try and clear the cache and all, but it didn't solve the problem.

Capture d'écran 2025-04-09 095953.png
April 9, 2025 at 6:25 pm #16915615

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Thank you for updating me!

This behavior is not expected and will need to be further investigated. At the moment there is no known issue that is affecting other users or has been reported, therefore my guess is that we are dealing with something that is environment related.

I would like to request temporary access (wp-admin and FTP) to your site to test the issue.
(preferably to a test site where the problem has been replicated if possible)

**Before we proceed It is necessary to take FULL BACKUP of your database and your website. Providing us with access, you agree that a backup has been taken **

I often use the Duplicator plugin for this purpose: http://wordpress.org/plugins/duplicator/
You will find the needed fields for this below the comment area when you log in to leave your next reply.
The information you enter is private which means only you and I have access to it.

NOTE: If access to the live site is not possible and the staging site does not exist please provide me with a duplicator package created with the duplicator plugin.

Thank you,
Bobby

The topic ‘[Closed] The wp-wpml_current_language is not updated, or updated to the wrong language.’ is closed to new replies.