Skip to content Skip to sidebar

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 0 voices.

Last updated by Otto 2 weeks, 2 days ago.

Assisted by: Otto.

Author Posts
November 27, 2025 at 5:49 pm #17616153

danM-2

Background of the issue:
I am trying to use WPML to automatically convert URLs to the translation of a post when it is duplicated. For example, if an English post links to /about-us, the Spanish version should link to /sobre-nosotros. We are also using hidden link to configure custom permalinks for taxonomies and pages. However, WPML is not aware of these custom permalink structures. We have identified that the URL conversion feature happens in the WPML class `AbsoluteLinks`. We can disable the functionality with `wpml_sl_blacklist_requests`, but we can't find an appropriate hook to re-implement the functionality using our custom permalink structures. For pages, we can use the `url_to_postid` filter to return the correct post ID, but we can't return a term from `url_to_postid`.

Symptoms:
WPML is either not translating URLs or resolving to a completely wrong URL due to incompatibility with custom permalink structures. We need a filter within `_process_generic_text` or another part of `AbsoluteLinks` to override the translated URL.

Questions:
Is there a filter within `_process_generic_text` or another part of `AbsoluteLinks` to override the translated URL?
Where can we find an appropriate hook to reimplement the URL replacement feature if we disable the default functionality with `wpml_sl_blacklist_requests`?

November 27, 2025 at 6:48 pm #17616430

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello,

No, there is currently no filter that lets you override a translated link inside _process_generic_text(). If you need to change the final link, you’ll have to reproduce the replacement outside this class or patch the plugin.

I am sorry I can't be of better help regarding this problem.

Best Regards,
Otto