Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client was experiencing a CORS error because WPML did not update the URL returned by

plugins_url()

. This issue occurred when trying to load JavaScript files across different mapped domains, resulting in files being loaded from an incorrect domain.
Solution:
The client resolved the CORS error by resetting WPML and re-entering the domains, which corrected the URL mapping for JavaScript files. If you're experiencing this issue, we recommend trying the same steps: reset WPML and ensure your domains are correctly entered.

Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.

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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Dražen Duvnjak 3 days, 2 hours ago.

Assisted by: Dražen Duvnjak.

Author Posts
October 1, 2024 at 8:13 am

Benjamin Bornschein

Background of the issue:
The selected domain is the main domain, the domain hidden link is mapped to english.

We are using the default theme "Twenty Twenty-Four", which uses JavaScript modules instead of regular JavaScript files.
WPML does not change the URL of `plugins_url` (https://developer.wordpress.org/reference/functions/plugins_url/) which results in trying to load JavaScript files from hidden link while being on hidden link which causes a CORS error.

Symptoms:
This results in a CORS error. In the Developer Tools > Network the `view.min.js` from should be loaded via hidden link. Instead, it is loaded via hidden link causing the issue.

Questions:
Why does WPML not update the URL returned by plugins_url?
How can I resolve the CORS error caused by the incorrect URL?

October 1, 2024 at 8:27 am
October 1, 2024 at 8:48 am #16239072

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

I have tried to reproduce but it works fine, and files are loaded from correct 2nd domain.

Feel free to check via the next test site and add the correct 2nd domain to your localhost.

- hidden link

Regards,
Drazen

Slika zaslona 2024-10-01 u 10.45.24.png
October 1, 2024 at 12:07 pm #16240255

Benjamin Bornschein

Thank you for your quick investigation. I reset WPML and re-entered the domains, which solved the problem.

Benjamin Bornschein confirmed that the issue was resolved on 2024-10-01 12:07:22.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.