Skip to content Skip to sidebar

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 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Andreas W. 1 year, 3 months ago.

Assisted by: Andreas W..

Author Posts
April 11, 2024 at 9:13 am #15507889

Walter777

Hello,

by inspecting html source of hidden link, I see there is a block:

<script id='wpml-cookie-js-extra'>
var wpml_cookies = {"wp-wpml_current_language":{"value":"en","expires":1,"path":"\/"}};
var wpml_cookies = {"wp-wpml_current_language":{"value":"en","expires":1,"path":"\/"}};
</script>

With two "var wpml_cookies = ..." identical lines.
Checking the php source code of WPML plugin I figured out it shouldn't be by design. So I ask if you have an idea why it may happen and if you can actually confirm it happens on some site of yours.

--

Also, if I'm logged out from the dashboard, the <script id='wpml-cookie-js-extra'> is missing completely from front end. Is it by design too? In what conditions that scripts is present in front end?

Thank you

April 11, 2024 at 3:57 pm #15510330

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

What makes you think that this is a design issue?

The variable "wpml_cookies" is a JavaScript object that includes all cookies. It saves all the cookies inside one variable as an object by using key and value pairs.

hidden link

This variable can be called various times to add, edit or remove entries from this object.

More details about our cookies can be found here:
https://wpml.org/documentation/support/browser-cookies-stored-wpml/

Some cookies will only be set if a user is logged in.

Best regards
Andreas

April 12, 2024 at 7:31 am #15511556

Walter777

Uhm, please re-check my first message.

The variable definition appears two times, in two lines, same values, identical. This is what I was referring.

var wpml_cookies = ...
var wpml_cookies = ...

Immagine 2024-04-12 093117.jpg
April 12, 2024 at 3:13 pm #15513348

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Sorry, yes indeed this is a duplicated entry. I will try to recreate this issue on a new test site and then get back to you.

April 12, 2024 at 4:49 pm #15513629

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I can not yet confirm this issue on my test site:
hidden link

Could it be that your site is using custom code that hooks into the WPML cookie behavior?

On your staging, could you please run the website with minimal setup to see if the problem persists?

1) Disable any additional plugins that have nothing to do with WPML and our add-ons. Does the issue persist?

2) If the issue goes away, start reactivating plugins one at a time or reactivate them in small groups. In this way, check where the problem occurs again to see the plugin that is causing the problem.

3) If this does not resolve the cause of the problem, please switch the first switch to the Space Oddity parent theme, then test again. If the issue still occurs, switch to a standard theme such as Twenty Twenty-Four to see if the problem may be related to the theme.

Once we have identified the cause, we can then attempt to replicate the problem and then escalate it internally.

The topic ‘[Closed] Two lines for "var wpml_cookies = …", or nothing.’ is closed to new replies.