Skip Navigation

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

Problem:
The client is using Elementor and WooCommerce to display carousels with links to product attributes (brands) that are set to 'not translatable'. The links should link to the current language version, but WPML is altering them to the default language. The client wants these specific links to remain unchanged in the translated pages.
Solution:
We recommended adding a custom filter to the theme's functions.php file to prevent WPML from altering these specific links. Here is the code snippet to add:

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

This code will add the specified brand to a blacklist, preventing WPML from translating the URL. For more information on managing sticky links in WPML, visit WPML Sticky Links documentation.

If this solution does not apply to your case, or if it seems outdated, 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 issues persist, 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.

Tagged: 

This topic contains 0 replies, has 1 voice.

Last updated by Dražen 19 hours, 27 minutes ago.

Assisted by: Dražen.

Author Posts
February 17, 2025 at 7:45 am #16711922

Dražen
Supporter

Languages: English (English )

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

Hello,

I tried, but I can not get passed by Server protection, maybe the provided data is not correct.

Please note I will disable all other plugins and switch themes, to confirm issue happens without any custom code / plugin.

Regards,
Drazen

February 17, 2025 at 4:48 pm #16715751

amigosS

Hello, sorry I pasted the wrong pass. I tried to edit the post but every time I click on "edit", it closes the post.
Can you turn on private forms so I can send you the new one ?

I already changed the theme to default.
I will deactivate the plugins except for the ones I had activated on the staging site you sent me the other day (woocommerce, elementor, wpml stuff), ok for you ?

February 18, 2025 at 7:16 am #16717007

Dražen
Supporter

Languages: English (English )

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

Hello,

sure, sounds good.

I have enabled private reply.

Regards,
Drazen

February 18, 2025 at 2:05 pm #16719366

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks, I checked.

As I can see :

1) Your FR language page brand does not even exist in FR, so you can not add links to the nonexisting archive page.

Make sure first this page archive exists then we can check if and why link adding is not working.

You can see from here in language switcher, that there is no translation in other languages:

hidden link

2) Your Brands are not even showing in the backend so that is some kind of issue, I advise disabling further plugins.

hidden link

3) Brands are set to be not translatable. You can not have the FR page of that brand term if not translatable or translated.

You will need to translate them in order to have FR products assigned for that translated term/brand and show up fine.

You need to translate terms and products in order for a page to exist and work correctly.

So, for issues 2 and 3 if you need more help or have questions, you can start new chats or I can open a new ticket for you. Once that is working fine and translated, we can get back to the original issue, if you still have it, and why the FR link is not being added correctly.

Regards,
Drazen

February 19, 2025 at 11:18 am #16723939

amigosS

Hello, and thank you but

1/ The page does work, see here : hidden link

2/ We're talking about brand attribute, not the new Brands system introduced by woocommerce (see here hidden link ) Admin > Products > attributes.

3/ See 1/ the link works without any problem.

I don't want to translate these attributes are these are brands. All is working but the displayed link in the front office. I just want an option/code so wpml won't filter my links by checking if they exists or not (and they do exist and are working). And i'm sure it's taking some ressources to do this filtering, it would be better without it.

Thank you

February 19, 2025 at 2:54 pm #16725445

Dražen
Supporter

Languages: English (English )

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

Hello,

okay so let me help clear things out. When you set a brand to be not translatable, that means they do not have language information so they could be visited from other language URLs, but that is actually a bug to be fixed, and it should not be visible from other languages. I think this is fixed in new WPML versions since I can not reproduce it on my side.

Correct behavior is only default language archive exists for not translatable and only that works, what you are asking I am afraid it is not possible nor how it should work.

Example video of not translatable attribute assigned to a translated product:
- hidden link

If you want it to exist in 2nd language you need to have it translatable and then translated version assigned to translated product.

Regards,
Drazen

February 19, 2025 at 3:22 pm #16725570

amigosS

Hello,

About the "fixing it" : what you're saying would be a big issue for us. It's "working" now and it is great since some attributes don't need to be translated. Moreover, it allows us to keep the same slug for different languages instead of having something like ".com/brand/nike-en" and it is way less time consuming than having to translate each brands.
I'm not the only one using it like this, I think you better not "fix it" as it is not a bug for many users and it would break many websites.

Nevertheless, it was working on the website you set for me : the attribute was set to not translatable and I was able to display different link on the front office without wpml filtering the output by modifying the link. Since it worked on your website, I'm sure it can work on mine. I just don't know why it doesn't work and as you can see I used the same plugin and a default theme. My plugin was up to date when we started this thread. I'm quite sure a setting somewhere does something.

I really need to make it work and I know it can cause it worked on the website you shared before.

I don't understand why, if that's not a setting, I can't prevent wpml from filtering output links.. It would even accelerate the query since it would have to "verify" if the link exist. There might be a hook or something i can use to prevent this from happening.

Thank you

February 19, 2025 at 3:38 pm #16725645

Dražen
Supporter

Languages: English (English )

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

Hello,

Please update WPML plugins and Wocommerce to the latest versions. Go to Plugins > Add New > Commercial > Click “Check for updated" and update WPML plugins to the latest versions.

Let me know if you still can access the attribute FR URL and I will then check/compare it with test site from video in last reply.

Kind regards,
Drazen

February 19, 2025 at 4:26 pm #16725878

amigosS

Hello,

everything is up to date already : hidden link

All the other plugins are too.

I can access the archive page : hidden link

Other than that, I just want my URL to not being changed in the displayed output of the page, that's it. I checked the database and the url is the one I put "hidden link" but when looking the site, it becomes hidden link

I put the attachment again if needed, I feel like we don't understand each other.

In the first screenshot (ending with 03), you can see that I put the URL with /fr/ and in the second screenshot you can see that the url has been transformed. I don't want that to haopoen

Capture d’écran 2025-02-18 à 11.41.44.png
Capture d’écran 2025-02-18 à 11.41.03.png
February 20, 2025 at 7:08 am #16727430

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks, I understand your issue, but I need to check and confirm this also happens with the latest versions.

Your plugins are not the latest versions, please check and update them as I advised above or update manually to:

WPML 4.7.1, WPML String translation 3.3.1, Wocommerce Multignual 5.4.0 etc.

- https://wpml.org/account/downloads/

I tried but it does not get updated, probably my user does not have the required permission.

Regards,
Drazen

Installer ‹ AMIGOS SKATESHOP — WordPress.jpg
February 20, 2025 at 2:10 pm #16730083

amigosS

Hello,

I uploaded the new version, the bug is still here (on hidden link the first nike item points to hidden link instead of hidden link ) and the archive page is still accessible (as it should, imo : hidden link ).

February 20, 2025 at 2:34 pm #16730308

Dražen
Supporter

Languages: English (English )

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

Hello,

great, thanks for that.

Please allow me full network admin access, I need to be able to disable/enable plugins and themes.

Thanks,
Drazen

February 20, 2025 at 2:49 pm #16730368

Dražen
Supporter

Languages: English (English )

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

Hello,

so I was able to access network admin and try out some code to tell WPML to not adjust the link and it seems to work. For example, this is what I have added to theme function.php and it works fine:

add_filter( 'wpml_sl_blacklist_requests', 'wpml_sl_blacklist_requests', 10, 2 );
 
function wpml_sl_blacklist_requests( $blacklist, $sitepress ) {
    $blacklist[] = 'brand/nike-sb';
    return $blacklist;
}

- https://wpml.org/documentation/getting-started-guide/sticky-links/#:~:text=to%20permalinks.-,Linking%20to%20pages%20in%20a%20different%20language,-Sometimes%2C%20you%20might

Please check and let me know if this helps.

Regards,
Drazen

February 20, 2025 at 2:50 pm #16730369

amigosS

Sure thing, you can access it from My sites up left and use the same credentials

February 20, 2025 at 3:07 pm #16730442

Dražen
Supporter

Languages: English (English )

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

Hello,

please check my last reply after that one:

- https://wpml.org/forums/topic/i-want-to-prevent-wpml-from-changing-my-links-in-elementor/page/2/#post-16730368

Regards,
Drazen