- Status
- Resolved
- Reported for
- WPML Multilingual CMS 4.4.4
- Resolved in
- 4.4.9
- Related plugin/theme
- Elementor
Overview of the issue
In some language configurations with the latest release of WPML, the Elementor editor does not load, and it gives the following error in the browser console:
/en/wp-json/elementor/v1/globals:1 Failed to load resource: the server responded with a status of 404 (Not Found)
Some other plugins or themes may also experience 404 or 500 errors codes in the browser console when using the Language URL Format: Languages In Directories
Workaround
Our development team has fixed the issue and the fix will be shipped with the upcoming WPML release.
In the meantime, you can use the following workaround to fix the issue on your site:
- Backup your WordPress site files and database.
- Using FTP, navigate to wp-content/plugins/sitepress-multilingual-cms/classes/url-handling/converter/strategy/class-wpml-url-converter-subdir-strategy.php
- Replace this code snippet:
private function get_language_of_current_dir( $language_code, $value_if_default_language = null ) { if ( ! $this->use_directory_for_default_lang && $language_code === $this->default_language ) { return $value_if_default_language; } return $language_code; }with:
private function get_language_of_current_dir( $language_code, $value_if_default_language = null ) { /** @var SitePress $sitepress */ global $sitepress; $defaultLang = $sitepress->get_default_language(); if ( ! $this->use_directory_for_default_lang && $language_code === $defaultLang ) { return $value_if_default_language; } return $language_code; }