Skip Navigation

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

Problem:
You are trying to translate anchor points in links using WPML, but find that while the main part of the URL translates correctly, the anchor part does not. For example, translating https://www.mysite.org/link/#anchor to https://www.mysite.org/es/link-es/#anchor-translated does not work for the anchor segment.
Solution:
We recommend adding a custom XML configuration to your WPML settings to enable translation of the anchor parts of links. Here is the XML configuration you should add:

<wpml-config>
  <elementor-widgets>
    <widget name="text-editor">
      <fields>
        <field>editor</field>
      </fields>
    </widget>
    <widget name="button">
      <fields>
        <field>text</field>
        <field>link>url</field>
      </fields>
    </widget>
    <widget name="menu-anchor">
      <fields>
        <field>anchor</field>
      </fields>
    </widget>
  </elementor-widgets>
</wpml-config>

After adding this configuration, use the Advanced Translation Editor to search for "http" and translate the link as needed.

Please note that this solution might be outdated or not applicable to your specific case. If this solution does not resolve your issue, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If further assistance is needed, please open a new support ticket.

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 0 replies, has 0 voices.

Last updated by Kor 3 weeks, 5 days ago.

Assisted by: Kor.

Author Posts
March 12, 2025 at 9:05 am #16805806

eloiC-2

Background of the issue:
I'm trying to translate links with anchor points on my site under development. For example, I want to translate a link like hidden link to hidden link. WPML translates the first part of the link correctly, but not the anchor part.

Symptoms:
WPML does not translate the anchor part of the link, and I am unable to translate it manually.

Questions:
How can I translate the anchor part of a link using WPML?

March 13, 2025 at 6:47 am #16809868

Kor
Supporter

Languages: English (English )

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

Thanks for contacting us.

I will need to closely examine your website to see how the links are created and translated. 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.

March 13, 2025 at 4:03 pm #16812830

Kor
Supporter

Languages: English (English )

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

Thanks for your patience.

I've added the custom XML configuration below into WPML > Settings > Custom XML Configuration here hidden link and you should be able to translate the link now as shown in the attached screenshot. You need to type "http" on the search form provided in the Advanced Translation Editor.

<wpml-config>
  <elementor-widgets>
    <widget name="text-editor">
      <fields>
        <field>editor</field>
      </fields>
    </widget>
    <widget name="button">
      <fields>
        <field>text</field>
        <field>link>url</field>
      </fields>
    </widget>
    <widget name="menu-anchor">
      <fields>
        <field>anchor</field>
      </fields>
    </widget>
  </elementor-widgets>
</wpml-config>
Screenshot 2025-03-14 at 12.01.34 AM.png