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

Supporter timezone: Asia/Singapore (GMT+08:00)

This topic contains 0 replies, has 0 voices.

Last updated by Kor 1 month, 1 week ago.

Assisted by: Kor.

Author Posts
December 12, 2024 at 4:35 pm

Emke Douwe Ottema

Background of the issue:
I have some buttons set as translatable. After translating the buttons in the translation editor, ?lang=nl is being added to external links.

Symptoms:
Some external links aren't working because ?lang=nl is added.

Questions:
How can I prevent that ?lang=nl is added?

December 12, 2024 at 4:54 pm
December 12, 2024 at 5:02 pm #16509049

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience.

Here is the ticket. I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.

Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.

Your upcoming reply will be treated with confidentiality and will only be visible to you and me.

✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.

December 18, 2024 at 3:05 pm
December 19, 2024 at 11:33 am #16529799

Dražen
Supporter

Languages: English (English )

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

Hello,

Kor is OFF for a few days, so I checked the ticket and the issue.

I can see you are using the ACF link field and have set it to Translate settings, so in this case, you actually need to translate it fromthe Advanced translation editor, or if you wish to use the same value, set this field to Copy and re-translate the page.

Hope this helps, let us know how it goes.

Regards,
Drazen

Advanced Translation Editor - WPML.jpg
December 24, 2024 at 2:06 pm #16543990

Emke Douwe Ottema

Hi there,

I already tried to insert an other url as translation. When i replace the url to hidden link for example, it's still adding ?lang=nl to that url so the translated url is pointing to hidden link.

Scherm­afbeelding 2024-12-24 om 15.05.36.png
December 24, 2024 at 5:38 pm #16544393

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply. I can see the issue that you mentioned. I suspect the problem is related to your theme.

It seems to work fine when I switch to the Twenty Twenty-Five Theme and translated a button on this test page hidden link

Translated: hidden link

I will need to escalate this further for you. Could you replicate the issue on our sandbox site here so that I could include this in the report?

Here is the access link hidden link and kindly install the required themes and plugin and create a test page to replicate the issue.

January 6, 2025 at 10:10 am #16565628

Emke Douwe Ottema

Hi there,

I’ve identified the source of the issue. I added the following line:

$link_url = apply_filters('wpml_permalink', $link_url);

This ensures that the buttons in the hero section automatically link to the translated content. However, when I remove this line, the "?lang=nl" parameter is not added, so it works for external URLs. But in cases where I link to another page within the site, the button does not redirect to the translated page but instead defaults back to the original language. For example: hidden link

Is there a way to make the button automatically link to the translated content? Or should i place the filter in an IF statement where i check if the domain is equal as the current domain.

January 6, 2025 at 10:18 am #16565667

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply.

If you're using a static link then you'll have to translate the link manually. If you use dynamic links, WPML should be able to connect the link to the correct translated page. Do you use any page builders like Elementor?

January 9, 2025 at 4:33 pm #16578952

Emke Douwe Ottema

Hi there,

We're using the Link field from ACF. This field is set to translatable.

It works if we manually change the URL in the translation editor. However, I would like it to automatically point to the translated version of the original page when it is not manually set in the translation editor.

January 9, 2025 at 4:35 pm #16578957

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply.

Sorry, this is not possible though. The links must be translated manually.

The topic ‘[Closed] Lang parameter added on external websites’ is closed to new replies.