Home›Support›English Support›[Resolved] Perhaps an issue with cache and synchronisation in translating slugs within URLs
[Resolved] Perhaps an issue with cache and synchronisation in translating slugs within URLs
This thread is resolved. Here is a description of the problem and solution.
Problem: The client is experiencing sporadic issues with translating slugs within URLs on their website, where slugs appear in the secondary language instead of the main language and vice versa. The issue seems to resolve itself, suggesting a potential cache problem. Solution: We recommend the following steps when the issue occurs again: 1. Re-save the permalink structure. 2. Flush the cache memory. 3. Go to WPML -> Support -> 'troubleshooting' link and click on 'Clear the Cache in WPML', 'Fix element_type collation', and 'Set language information' buttons as described in this link. 4. Activate the WordPress debug mode as described in this guide and check for any error messages in the debug.log file. 5. If the issue persists, consider creating a staging site with a copy of the live site, leaving only the WPML and WooCommerce plugins to double-check if the issue appears again.
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your case, we highly recommend checking related known issues here, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, please open a new support ticket here for further assistance.
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.
Background of the issue:
I am experiencing an issue with translating slugs within URLs on my website. The problem has been occurring sporadically over the years, and I suspect it might be related to cache. The main language of the site is .com
Symptoms:
Occasionally, slugs appear in the secondary language instead of the main language in product page URLs, and vice versa. The issue seems to resolve itself without intervention, possibly indicating a cache problem.
Questions:
Is this issue related to cache?
Have you encountered this problem before and know how to resolve it?
I had written a lengthy explanation before my text was broken down during the ticket creation process. So, I'm re-pasting it for greater clarity to help understand the issue.
Good morning, I’d like to address an issue that I’ve been noticing for quite a while now—over a few years, actually. It hasn’t had a major impact on our work, but it does exist, and I’d like to understand if it’s possible to resolve it. I suspect it might be a cache issue. Let me explain what happens.
From time to time, we look at the URLs of product pages, maybe because we have the sitemap in hand, or because we’re moderating product comments and see the product URLs. While doing so, we occasionally notice, in a completely random way and without any identifiable pattern, that slugs appear in the secondary language instead of the main language.
Let me give you an example. I’ll preface by saying that .com is the main language.
The correct URL should be:
website.com/scarpe/nike-air/
Instead, sometimes we find:
website.com/shoes/nike-air/
Where "shoes" is, of course, the translated slug for the secondary language. Other times, we find the opposite: the main language slug appears instead of the secondary language one.
For example, the correct URL should be:
website.com/en/shoes/nike-air/
But instead, we find:
website.com/en/scarpe/nike-air/
It happens rarely, but it does happen. The link still works because an internal redirect takes place, but the issue remains, and I’d like to solve it.
Last night, for instance, I noticed the same thing. What makes me lean towards a cache problem is the fact that the URL I saw last night had corrected itself by this morning, without me doing anything at all.
Now, of course, the “cache” theory is just my own thought. As the site is live and I don’t have a way to replicate the issue in a staging environment, all I can do is guess. However, I’d love to have your feedback on this. Maybe it’s something you’ve encountered before and know how to tackle. We genuinely wouldn’t know where to begin.
The issue described is hard to solve or isolate its cause if only happens randomly, however, if flushing the cache memory solves the issue, then it is a cache problem.
I recommend to follow these steps when you encounter the problem again:
- Re-save the permalink structure
- Flush the cache memory
- Go to WPML -> Support -> 'troubleshooting' link and click on 'Clear the Cache in WPML', 'Fix element_type collation' and 'Set language information' buttons as described in this link: https://wpml.org/documentation/support/wpml-troubleshooting-options/
In the case that the issue happens in the future I'd recommend creating a staging site with a copy of the live site and leaving only the WPML and Woocommerce plugins, the double-check if the issue appears again. That will provide more information to work with.
Thank you very much for your understanding!
Have an excellent day.
Best regards,
Carlos
I’m sorry, but I didn’t say it was a cache issue. I only mentioned that we hypothesised it might be, given that at a certain point, the problem seems to resolve itself, as if by magic.
Your reply seems to confirm that you haven’t the faintest idea what might be causing the issue, and that nothing similar has been encountered before, correct?
I ask because, in trying to search through other tickets, I haven’t found anything like it.
Yes, you are correct, I investigated in our support forum, escalated tickets and known issues but found nothing like it. I would be more than happy to take a look at the site, however, because the nature of the issue is random, it will be hard for me to isolate its cause. Also, as you mentioned already, the issue disappears without making any change, which makes me believe that your theory of cache issue might be on the right path.
I have set your next message private so you can securely share the access credentials to the site. I won't make any changes, I will only take a look at the WPML configuration 🙂
Sorry, Carlos, but for security and privacy reasons, I can’t grant you access to the live site. Unfortunately, it’s not a small website but rather a fairly large one, so we have to proceed with caution.
If it’s a caching issue, I should mention that we use LiteSpeed. Is there anything you think we should consider excluding? Honestly, I have no idea what could be causing the problem, but I suspect there’s a moment when WordPress regenerates its URL database, and that’s when the mishap occurs.
I understand you can't grant us access to the live site.
With LiteSpeed there is only one known issue and the rest is fully compatible with WPML, you can double-check it here: https://wpml.org/plugin/litespeed-cache/
There isn't a special set-up required.