[Resolved] Split: Some links in the site are not translated
This thread is resolved. Here is a description of the problem and solution.
Problem: If you're experiencing issues where the links on buttons on your site always load in Bulgarian, regardless of the language you are in, and you're wondering if you need to manually set the links for each language separately. Solution: First, we recommend editing the links in the main language to be relative instead of absolute. For example, change the link from 'https://example.com/product-category/product/' to '/product-category/product/'. Save the page in the main language, then edit and save the translations without changing anything. This should allow WPML to automatically adjust the links for each language.
If the issue persists, it might be due to the links being encoded, which prevents WPML from auto-adjusting them. In this case, follow these steps: 1. Go to WPML -> Settings -> Custom XML configuration and add the following code:
2. Edit the file: wp-content/plugins/sitepress-multilingual-cms/inc/absolute-links/absolute-links.class.php in the method: \AbsoluteLinks::_process_generic_text right after:
After applying these changes, make a minor edit to the home page and save all translations as they are. This should correct the URL issues in secondary languages.
If this solution does not resolve your issue, or if it seems outdated or not applicable to your 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 problem persists, 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.
Hi Mateus,
What I notice is that the links on the buttons on the site load the Bulgarian version, regardless of which other language I am in, do I have to manually set the links for each language separately.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
I checked it and it looks like the links are added as absolute/full links. In order for WPML to translate it automatically for you, you can edit the links in the main language and set them as relative links. Eg.: I edited the link in the button "Sehen Sie sich die Produkte an" from hidden link to /product-category/viviscal-man/.
After that, I saved the page in the main language, edited the German translation as a test and just saved it as it is. Now when I check the link of that button in the German language, it is pointing to the correct domain.
Please check the screenshots I attached to my reply.
In order to fix it, you need to edit the links in the main language, remove the domain and save them as relative links as shown in the screenshot. Then you edit the translations one by one and just save them as they are without having to edit the translation.
After that the issue with the links should be fixed.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello Boyan,
I checked it and the issue with this specific link is that it was created as a custom link.
To see it you can go to Appearances > Menu > Главно - Немски (Main) or please check the screenshot to view it.
I reviewed this issue and the links were incorrect in the menu, to fix it I followed the steps:
- Go to Appearances > Menu > Главно - Немски
- Switch to German in the admin top bar
- Edit the link Viviscal für Männer changing it from hidden link to hidden link
- Edit the link Viviscal für Frauen changing it from hidden link to hidden link
After that I tested it and the links are working correctly.
Please notice that WPML can't automatically adjust custom links. It is possible to translate/edit the URLs and labels of custom links in two ways:
1) Manually from the Appearance → Menu page like I did above.
Thank you Matheus,
I think I can solve the menu problem. Apparently I didn't ask the question correctly. I mean the problem with the links to the buttons. I am attaching a photo. I did what you advised, but only the links in Greek work correctly.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello Boyan,
Thank you for sharing that information, I apologize for the confusion, I was able to see and replicate the issue now.
I'd like to ask permission to make a copy/staging version of your site where I can debug this closely without affecting the live site.
I'll make sure to delete this copy as soon as we get this issue fixed.
I'm afraid of debugging directly on the live site and cause issues to your visitors. Also, it is important to test a different setup as part of the troubleshooting.
Thanks Mateus, please feel free to make a replica of the site. I don't know if it's right to post another case study here, if not, please ignore it. I have chat plugins but it is only active in viviscal.bg and in all other domains of viviskal.store i am not showing up can you advise me how to proceed
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hi,
Thank you for your patience while we're investigating this issue.
I have escalated this ticket to our 2nd tier of support where our 2nd tier specialists will take a deeper look at this issue and will try to find a solution.
I will get back to you as soon as I get an answer from them.
Languages: English (English )Portuguese (Brazil) (Português )
Timezone: America/Sao_Paulo (GMT-03:00)
Hello there,
Thank you for your patience while we investigated this issue.
Upon further review, our 2nd tier team identified that those buttons belong to the module et_button and the URL/link is encoded. This was preventing WPML from auto-adjusting those fields.
To fix it, we followed the steps:
- Go to WPML -> Settings -> Custom XML configuration and add the following code:
- Edit the file: wp-content/plugins/sitepress-multilingual-cms/inc/absolute-links/absolute-links.class.php in the method: \AbsoluteLinks::_process_generic_text right after:
This second part is a workaround needed for the links in this button module be properly adjusted, we're working to have this included by default in the next versions, but it is important to check in new updates if the issue comes back so you can apply this workaround again.
After performing those steps, I made a minor change to the home page(added an empty space) and edited all translation, just saving them as they are.
Now, when I check the secondary languages, the buttons look to be pointing to the correct URL.