Skip Navigation

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

Problem:
If you're experiencing issues where WPML automatically adds language subfolders (e.g., /nl/) to Lasso cloaked links on your multilingual WordPress site, causing the links to break on translated pages, we can help.
Solution:
We recommend adding a specific filter to your theme’s functions.php file to exclude certain links from being automatically translated by WPML. Here’s how you can do it:

add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );<br />function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {<br />    $blacklist[] = 'your-slug-here';<br />    return $blacklist;<br />}

Replace 'your-slug-here' with the slug of the page in the original language that you want to link to without translation interference. For example, if you want to link to an English page with the slug 'premium-dip-belt-calisthenics-equipment-by-gornation', you would add this slug to the $blacklist array.

If this solution does not fully resolve your issue or seems outdated, or if your case requires a more tailored approach, 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. Should you need further assistance, please do not hesitate to open a new support ticket with us at WPML support forum.

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 3 replies, has 1 voice.

Last updated by Dražen 2 weeks, 5 days ago.

Assisted by: Dražen.

Author Posts
March 19, 2025 at 9:15 am #16833854

jariD-3

Background of the issue:
I am trying to resolve an issue with WPML and Lasso cloaked links on my WordPress site. My site is multilingual using WPML, with English as the default language and Dutch as the translated version. The language structure follows subfolders (/nl/ for Dutch, / for English). I use Lasso to cloak affiliate links. On English pages, Lasso cloaked links work perfectly. But on Dutch translated pages, WPML automatically adds /nl/ to the cloaked links. I need WPML to leave Lasso links unchanged so that they don’t get modified in translated content. I already tried excluding it via advanced setups and various settings. I also contacted Lasso, but they directed me to WPML. Link to a page where the issue can be seen: hidden link (English) >> hidden link (Dutch page).

Symptoms:
On Dutch translated pages, WPML automatically adds /nl/ to the cloaked links, which breaks the link (404). Example: Correct (English page): hidden link. Incorrect (Dutch page): hidden link.

Questions:
How can I prevent WPML from adding /nl/ to Lasso cloaked links on Dutch pages?
Why are Lasso links being modified in translated content despite being set to 'not translatable'?

March 19, 2025 at 10:00 am #16834310

Dražen
Supporter

Languages: English (English )

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

Hello,

Thanks for contacting us.

While you wait for my colleague to take over the ticket, let me try to help you with the issue quickly.

To be able to add links to pages in other languages, you need to add the following filter to your theme’s functions.php file.

Allow links to pages in other languages

add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );
 
function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
    $blacklist[] = 'documentation';
    return $blacklist;
}

In the above code, use the $blacklist array to specify all the URL slugs for the pages in the original languages that you want to link to.

In our example, we want to link to English version of “Documentation” (slug “documentation”). In your case, you would for example use "premium-dip-belt-calisthenics-equipment-by-gornation".

Regards,
Drazen

March 22, 2025 at 12:44 pm #16847510

jariD-3

Hi Drazen,

Thanks for your reply, but as I understand your colleague needs to give me more insights? It would be helpful if we have a more permanent solution than adding code to the php file on my theme. Eventually we need more translations to more countries and we need a really solid foundation. Hope you understand and hopefully your team could help me with this!

Gr. Jari

March 24, 2025 at 7:03 am #16849815

Dražen
Supporter

Languages: English (English )

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

Hello,

it was just the first reply to help with the issue, to not wait.

I am afraid that filter is intended for such a solution when you do not wish to use translated links, since WPML is a translation plugin and it is expected to translate the URLs on translated pages. In such cases when you need to use default language URLs on the translated page we provide a filter that I already shared.

I am afraid for any other solution, you would need a custom solution since WPML does not have an option out of the box for this, for such custom case we suggest WPML contractors: https://wpml.org/contractors/

Hope this helps.

Regards,
Drazen