Skip Navigation

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

Problem:
The client is experiencing issues with translating internal English URLs to Spanish on their multilingual site. The 'Adjust Links Feature' does not update the links, and manually adjusting them across numerous pages is not feasible. The issue was identified in the

WPML_Name_Query_Filter_Translated

class, where the logic incorrectly returns the first URL match for all subsequent links.
Solution:
If you're experiencing similar issues with internal link translations in WPML, we recommend applying a temporary workaround. Navigate to

wp-content/plugins/sitepress-multilingual-cms/inc/query-filtering/wpml-name-query-filter-translated.class.php

and add the following line at line 49:

$this->pages_to_langs = array(); //workaround!!!

This code resets the array that was incorrectly storing URLs, allowing each link to be translated correctly. For detailed guidance on translating links, please visit https://wpml.org/faq/how-to-translate-links/.

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 issue persists, please open a new support ticket at WPML support forum for further assistance.

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

Last updated by hayesP 1 month, 1 week ago.

Assisted by: Kor.

Author Posts
April 28, 2025 at 3:10 pm #16975610

Kor
WPML Supporter since 08/2022

Languages: English (English )

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

Thanks for your patience. Our 2nd Tier Support provided a workaround for this. Please navigate to wp-content/plugins/sitepress-multilingual-cms/inc/query-filtering/wpml-name-query-filter-translated.class.php line 49

Add the code below as shown in the attached screenshot.

$this->pages_to_langs = array(); //workaround!!!

Now the links works when you checked here hidden link

Screenshot_96.jpg
April 28, 2025 at 11:41 pm #16976861

hayesP

Thank you for looking into the issue and posting that patch. We have made that update in our systems and are seeing the URLs translated as expected. Do you know if this will be added to a point release for WPML in the near future?

April 29, 2025 at 6:21 am #16977231

Kor
WPML Supporter since 08/2022

Languages: English (English )

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

Thanks for your reply. Yes, this workaround will be included in future updates. For now, it is still under review by our devs.

May 2, 2025 at 12:35 pm #16989559

hayesP

Thank you for your help and the workaround. We'll monitor future updates and remove the patch when the core plugin has a resolution in place.