TranslatePress caching issue – default language gets served
-
We’ve recently encountered an issue with TranslatePress and SiteGround Optimizer. This issue is not present when using WP Rocket with TranslatePress and after purging cache the issue is fixed for some time.
- The translated homepage is being served in the default language after a few hours. At first it seems to work, but I setup a keyword monitor and after 2-10 hours the translated homepage goes to showing the default language instead.
- This happens when the slug remains the same, but only the language slug differs.
- Example:
- Not working:
https://website.nl/en/
- Working:
https://website.nl/en/the-catering-industry/
- The issue does not occur because the default URL is
https://website.nl/nl/de-horeca/
, and SiteGround Optimizer recognizes it as a different URL.
- The issue does not occur because the default URL is
- However, for the homepage (
/en/
), SiteGround Optimizer does not treat it as a unique page.
- Not working:
This is what TranslatePress support told me
We’re not entirely sure how that caching plugin works. It could be it’s using object buffering to capture the page output, but does so before TranslatePress replaces all the content with the translated version. TranslatePress also uses object buffering for translations.For testing purposes you can try to use a plugin like WP Super Cache and see if that causes the same issue. Also, try and reach out with this issue to the Siteground Cache developer, maybe it’s something they can change on their end when it comes to caching translated pages.
If the plugin is using home_url() function to get to a path it treats /en/sample-page the same as /fr/sample-page. Because we filter the home_url() in order for TranslatePress to function. When you translate the slug, you now have two cached pages. So it’s possible the caching plugin is serving /en/sample-page content instead of /fr/sample-page.?
Definitely open a ticket with them, maybe they can fix this in a future update.
- You must be logged in to reply to this topic.