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.

This topic contains 7 replies, has 2 voices.

Last updated by Andrey 10 months, 2 weeks ago.

Assisted by: Andrey.

Author Posts
July 29, 2024 at 1:12 pm #16016175

edwinv-4

Background of the issue:
I am developing a site and want to link internally to another language using WPML. WPML automatically translates links if a translation is available through 'Translate Link Targets', which is generally desirable. However, I sometimes want to link to a page in another language intentionally.

Symptoms:
I cannot find a way to link to a page in another language without WPML automatically translating the link.

Questions:
Is it possible to link internally to another language without WPML automatically translating the link?
Is there a way to use a class or ID in the link to prevent WPML from translating it?

July 29, 2024 at 6:35 pm #16017622

Andrey
WPML Supporter since 06/2013

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

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

Thank you for contacting WPML support.

Depending on how you added your link to the page, you can try translating it in WPML's Advanced Translation Editor by adding your link to the translation using the language configuration file.

https://wpml.org/documentation/support/language-configuration-files/

It could be that your link is already available for translation. Have a look here: https://wpml.org/announcements/2020/02/translating-links-with-advanced-translation-editor/

When you’re editing with the Advanced Translation Editor, look for a “Search” input at the top-left. This search box allows you to find any text on the page, visible or not. It’s especially useful for translating links. If you search by “http” you’ll quickly find all outgoing links on the page.

July 30, 2024 at 12:27 pm #16020523

edwinv-4

Hi Andrey,

Thanks for your reply. We're using the normal WordPress editor, but when saving and updating the translations, it is overwritten. We would like to ignore this in the WP editor with somekind of class, ID or whatever. How would solve this?

Thanks in advance.

July 30, 2024 at 3:20 pm #16021247

Andrey
WPML Supporter since 06/2013

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

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

Thank you for your feedback.

There isn't a straightforward solution for this question, and no settings or classes are able to handle it. WPML automatically translates links, which is typically what users expect.

If you're using Gutenberg blocks to create content with links and the WPML translation editor to translate the page, you can attempt to find the specific Gutenberg block containing the link and change the type="link" to something else. This should prevent the link from being automatically converted.

Here is an example of how it can appear

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="core/some-block" translate="1">
        <xpath type="link">//a/@href</xpath>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

https://wpml.org/documentation/support/language-configuration-files/make-custom-gutenberg-blocks-translatable/

In this configuration, specifying type=”link” for the url attribute enables WPML to automatically translate the URL.

The links may not be converted if you are not using a WPML translation editor but a WordPress editor for translations.

I can't promise 100% success, as this is something that is not expected with the current WPML features, but these ideas are worth trying.

August 2, 2024 at 1:29 pm #16033706

edwinv-4

Hey Andrey,

Thanks! I'm going to try that. Do you know if there is also a way to do this in the default WordPress editor instead of the Gutenberg editor? (old school) 😉

Thanks a lot!

Finn

August 5, 2024 at 10:56 am #16039218

Andrey
WPML Supporter since 06/2013

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

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

Hello Finn,

Unfortunately, there is no such way for the classic WordPress editor. You can add different links only if you are using a classic WordPress editor for translations also instead of a WPML translation editor.

August 8, 2024 at 1:36 pm #16053037

edwinv-4

Hi Andrey,

Aha, okay. That is not so nice. Sometimes our client would like to link simply to other pages in other languages, but as I understand there is no other option.

Thanks anyway for checking!

August 8, 2024 at 2:12 pm #16053230

Andrey
WPML Supporter since 06/2013

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

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

Hello Finn,

I do understand this. I performed additional tests using the Classic WordPress Editor after translating the link in the WPML Advanced Translation Editor. The link did not change even after running the "Translate Link Targets" option.

Screenshot-2024-08-08-at-17-10-30.png
Edit-Page-“Classic-Editor-Link-Test”-‹-wpmlsite-—-WordPress.png
Advanced-Translation-Editor-WPML.png