Background of the issue:
I am an administrator with the proper user capabilities on the site hidden link. I am trying to make a translation on a page using WPML. I have added myself as a Translator.
Symptoms:
I can't translate because it says I do not have permission, even though I am an admin.
Questions:
Why can't I translate even though I am an admin and added myself as a Translator?
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hello,
First of all, please make sure you have at least the latest stable release of WPML installed which is 4.6.15 (4.7.1 is the latest, you could try that one as well but after a proper backup).
If the problem continues after you do that and also update the related WPML plugins, can you tell me where exactly are you seeing that problem? is it in a page, in WPML > Translations, somewhere else?
Languages: English (English )Spanish (Español )Italian (Italiano )
Timezone: Europe/Rome (GMT+02:00)
Hello,
The problem here is that the REST call is done using the language directory when it shouldn't.
This is something that was fixed before, but I wanted to ask if you have any custom code that you can temporarily remove and see if the problem continues? if not, then would it be possible to switch the theme to a default one adn see if the problem continues?
if the directory is not there, then the REST call should work, that's what's currently blocking you and that's not happening on a clean site, so there must be some configuration or code altering this behavior.
After investigation, we think the issue is not related to the language directory.
Notes from our technical lead.
-The language URL-prefixed API calls work perfectly on staging and on our local machines (screenshot)
-The problem still occurs if I disable everything but WPML and switch to the Twenty Twenty Five base theme
-The WPML_REST_Request_Analyze class specifically appears to expect that the language slug is present in the URL
-The API routes on the development site work perfectly, and in fact they return different data based on language prefix, showing the appropriate language's pages and posts based on the specified base slug — which seems to be as intended by WPML (this is on another environment, staging.docebo.com)