Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 -
- 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 12:00 – 16:00 -

Supporter timezone: Europe/Zagreb (GMT+01:00)

Tagged: 

This topic contains 10 replies, has 1 voice.

Last updated by Dražen 1 day, 15 hours ago.

Assisted by: Dražen.

Author Posts
January 16, 2025 at 11:25 am #16601638

amigosS

Background of the issue:
I am using Elementor and Unlimited element to display carousels. I want the links to be linked to the current language. It works with all the links but the products attributes' ones (brands) because they are set to 'not translatable' and I don't want to translate them. I know the translated version of the links work though. Example: /brand/spitfire-wheels /fr/brand/spitfire-wheels/ work. Link to a page where the issue can be seen: hidden link

Symptoms:
On sliders with a link to a product attribute (brand), I expect to see the translated version of the link. Instead, I got the original language version of the link. WPML seems to be fixing them.

Questions:
How can I prevent WPML from changing my links in Elementor?
Why are product attribute links not showing the translated version?

January 16, 2025 at 2:05 pm #16602380

amigosS

Quick addition :
I have a shortcode that displays a list of brands (= products attributes).
It gets the content from a php page and edit all the links.

I stored in a var all the links separated by comas and displayed them in an html commented line before the rendered html and all of them are in the current language but the html code that is displayed has all its linked changed back to original language. WPML is 'fixing' the links using a wordpress hook somewhere. I need to prevent this action and be sure wpml doesn't change any link.

January 21, 2025 at 8:32 am #16616730

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks for contacting us.

You can try to use the wpml_sl_blacklist_requests flter and then re-translate page, and it should not adjust the slugs in 2nd language:

https://wpml.org/documentation/getting-started-guide/sticky-links/#:~:text=Sometimes%2C%20you%20might%20want%20to%20insert%20a%20link%20to%20a%20page%20that%20is%20in%20another%20language.%20Since%20Sticky%20Links%20adjusts%20the%20links%20automatically%2C%20it%20might%20prevent%20you%20from%20doing%20this%20and%20adjust%20the%20link%20to%20point%20to%20the%20same%20language%20instead.

But since you are using custom code I am not sure if this will work, you can also try switching to manual translation mode and manually adjust the 2nd language links to what you need: https://wpml.org/documentation/translating-your-contents/using-different-translation-editors-for-different-pages/

Or if nothing helps, hiring a WPML contractors to adjust your code and make it work correctly in 2nd language links also:

- https://wpml.org/contractors/

I hope this helps, let me know how it goes.

Regards,
Drazen

January 22, 2025 at 2:01 pm #16623493

amigosS

Hello, can you be more precise on this snippet please ?
And sorry for the misunderstanding but when I was talking about the custom code, it was just as an addition. The issue comes from translated elementor pages at first.

To explain in better :
- I have one homepage made with elementor.
- It has translated version.
- In this page, we have sliders with images and links.
- When translating links for different pages (normal pages, blogs, etc..) all is working great in all languages
- When translating brands link (which are product attributes set to "no translatable" since we don't translate brands BUT still have translated version of URL working (with the language is une the url), wpml shouldn't force the original version of the link.

Your solution seems to be the one we're looking for but we don't know what to put as $blacklist[] value. Can you help us on that ? (our brands url are : site.com/brand/the-brand-slug/

About the custom code : in these same pages, we call a shortcode that lists all the brands. To avoid long query when we charge the pages (as we want to make sure brands are not empty), we have a daily cron that writes all non-empty brands in a file, then the shortcode gets the content and displays it on our website. We tried to save all the links in a var and display it, it displays all the translated links for each pages but the displayed content of the shortcode itself is re-modified by wpml to the original version of the links. I think your solution could help us on that too.

Thank you

January 22, 2025 at 2:24 pm #16623675

Dražen
Supporter

Languages: English (English )

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

Hello,

I think I misunderstood the issue, I understood you want to keep it in the default language, but you actually wish to add a translated brend URL, correct?

If so, I have just tried you case and it seems to work fine in the test site, 2nd language not the translatable taxonomy URL stays the same, and WPML is not forcing the default language.

- hidden link

I suspect this could be an issue with your custom code or some additional plugin.

Would it be possible for you to confirm this issue still happens with the default theme and only WPML plugins and Elementor? We can also try it in the slider and on a regular page with text, to check what might be causing it.

Please try to reproduce the same issue in a simple example on this new test website:

- hidden link

Regards,
Drazen

January 22, 2025 at 6:10 pm #16624783

amigosS

Hello,

sorry. The issue is concerning woocommerce products' attributes. I can't try it without woocommerce plugin.

Here's how to reproduce it :
- install wpml, elementor and woocommerce
- create BRANDS attribute (do not use the newly added brands option in woocommerce, I'm talking about products attributes like sizes or whatever) with "brands" as a slug.
- in wpml setting, set this attribute as "not translatable".
- create an elementor page with the brand attribute link on a text/slider/widget (ie: hidden link) then translate this page with a translated link ( hidden link .

The attribute has to exist before ! (I tried writing a fake link : hidden link and I can see that it outputs "correctly" (since it doesn't exists it is filtered I think but like that : hidden link). I need wpml to just not filter urls by checking if they are good or not.

Let me know if you still see hidden link in the href of the translated version of the page.

January 23, 2025 at 7:41 am #16625796

Dražen
Supporter

Languages: English (English )

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

Hello,

okay, I tried to create the Cars attribute, since there is already taxonomy Brands from Wocommerce default.

But I can not get an attribute archive link to exist. This does not work even without WPML: hidden link

Can you please check and try to reproduce the issue:

- hidden link

Regards,
Drazen

January 28, 2025 at 3:24 pm #16642824

amigosS

Hello,

First, I could create brand attribute as I changed the slug in permalinks beforehand.

So :
- original : hidden link
- translated : hidden link
Both work even if pa_brand is set as non translatable.

I created a test page ( hidden link ) and its translated version ( hidden link )
I changed the links of the widget in the Spanish version and it's working.

Which brought two things :
1- when translating using the wpml translating page (admin > pages > clic on update/edit translated version of the page), I can't see/edit widget links. I have to do it using elementor on the Spanish version.

2- I think I know why it's not working on our website, it's because of a previous issue we had and I saw that many people had issues with cache ( https://wpml.org/forums/topic/object-cache-issues/ ). It's maybe because of our object cache. We are using APCu (not redis that we tried and isn't as good for us) and we discovered that when we shut down the cache, many links work better than when we activate the plugin. We tried many object cache plugins and system (redis as said previously) . In our previous tickets, someone from wpml sent me a plugin that works with cache plugins but it didn't really help.
It looks like there is a conflict with object caching. Do you have an idea to prevent this ?
What is even crazier is that when I put a link to a translated blog article or a fake brand, it works. It just doesn't work with products attributes.
(examples : hidden link and hidden link look at the links when your mouse is over a carousel item that goes to a brand).

But what is weird also is the same issue with our custom shortcode. As I said, we list all the links. I store them in a var and list them in some html that is called by the elementor page. What is weird is that if I display the content of the var (so just url in text format separated by comas), all links appear translated in all languages. But the html output called by elementor has the same error as the widgets, it edits the links back to their original version.

January 29, 2025 at 7:23 am #16644469

Dražen
Supporter

Languages: English (English )

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

Hello,

thanks for getting back.

As for the object cache, yes there are some issues with it and we advise disabling it why do you do the translation and work with WPML as it can cause issues, once you finish the translation you can enable it back to avoid issues. Please note I also do not see any mention of APCU, we only have Redis / object cache plugin in our compatibility list and have provided some workaround to exclude certain parts and it helps some clients. You can try to check with APC support / hosting if there is such things and try to exclude some parts from caching like Wocommerce, WPML, translations and etc.

But the best would be to keep it disabled when you do the translations.

Regards,
Drazen

January 31, 2025 at 11:24 am #16655147

amigosS

Hello,
I've flushed the cache, deactivated the object cache plugin but still I'm still having the issue.
I can translate all the links but the brands attribute ones.. Any idea what could cause this ? This is driving me crazy. Is there a setting I should verify or something ?

I don't have any plugin linked to this.

And the craziest part is with the shortcode (that lists all the brands attributes with at least one product in it).. It just makes no sense. As I said, if I store all the links in a var and display it as an html comment with all the link separated by comas, all the links are translated. But when I display the html (that generates a slider of all these brands), it turns all the link to original ones..
Nevertheless, I saw that if the generated links are like this : hidden link , the issue we have happens.
But if they are generated like this :
hidden link , then the generated links in the slider are all well translated.

It looks like the issue happens only on rewrote (rewrited ?) links.

January 31, 2025 at 11:37 am #16655186

Dražen
Supporter

Languages: English (English )

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

Hello,

I am afraid, as I have said before, we can not help with custom code issues. For custom code solutions you can hire WPML contractors: https://wpml.org/contractors/

If you can show me the issue/ WPML bug on the test site I provided, I can further have a look and see what is wrong.

Other than that the best I can do is offer to debug your staging website, but in conditions without custom code and custom themes/plugins, and probably would need to disable some plugins to see if any conflicts with link and etc, not sure if this is helpful for your case since it involves custom code/shortcode.

Let me know.

Thanks,
Drazen