Background of the issue:
I’m writing to report an issue we’ve recently encountered on our website. Some strings that were previously translated and correctly displayed on the frontend are now showing only in the original language. The translations themselves are still present and correct within WPML, and the strings are registered in the code using the following format: __('Original string', 'text-domain'). Link to a page where the issue can be seen: hidden link
Symptoms:
Translated strings are not displaying on the frontend and are showing only in the original language.
Questions:
Why are the translations no longer appearing correctly on the frontend?
How can we resolve the issue of translated strings not displaying?
I can see the problem with the strings in the English language on your site.
Can you please tell me where those strings come from?
Are they strings from your theme or a specific plugin?
Also, I don't see the Italian and Spanish versions of hidden link.
Can you please tell me why they are missing?
The strings in question come from the custom theme and are registered in the code using the standard WordPress function:
__('Original string', 'cammini')
The issue is that these strings are not showing their translations on the frontend, even though the translations exist in WPML and are correctly saved. They were displaying correctly until a few days ago, and no changes have been made to WPML settings or to the theme code related to those strings.
I've already tried removing and re-adding some of the strings, rescanning the domain, enabling the “Track where strings appear on the site” option, and clearing all caches — but the problem persists. Only the original language appears on the frontend.
Please let me know how I can further troubleshoot this.
This might be a caching issue. Please clear the cache to see if it helps. And also, please refer to the following known issue that started with WPML 4.7.
In this regard, I need to mention that supporting custom themes or plugins is out of the scope of our support forum. However, if you have a specific question about how to achieve something or want to show us a piece of code that you are using and ask questions about, we will do our best to answer them (regarding WPML of course.)
Just to clarify: the __() function has always worked fine for me across other themes, and it was working on this site as well up until about a month ago. I’ve already tried clearing all caches (server-side and plugin), but the problem persists. All strings are registered in String Translation and translated, yet on the front end the translations don’t appear (the original language is shown).
I’ve read the errata you linked for WPML 4.7. Is there a patch or a specific step I should follow to refresh/rehash string packages for theme files? I’d prefer not to switch to _e() since __() has been reliable so far.