This thread is resolved. Here is a description of the problem and solution.
Problem:
The client was experiencing issues with menu synchronization while using WPML's WP Menus Sync feature. The synchronization process broke the header, altered the footer format, and caused menus to display incorrectly in different languages.
Solution:
This bug is happening because of a compatibility conflict with the MotoPress Hotel Booking plugin. One of the functions of this plugin always returns *en-us* as a locale. This affects how things work inside because it always switches to that value, so even if you're using a specific language like German and you make a menu, it still tries to use the English language.
We recommended the client perform a full site backup before proceeding with the workaround. The steps are as follows:
1) Navigate to the
*wp-content/plugins/motopress-hotel-booking/includes*
folder.
2) Edit the
*translation.php*
file.
3) Locate line 315.
4) Replace the existing code with the new code provided, ensuring to save the changes.
From
protected function getRestoreLanguage() { if ( is_admin() && ! MPHB()->isAjax() ) { $locale = get_user_meta( get_current_user_id(), 'locale', true ); if ( empty( $locale ) ) { return $this->getDefaultLanguage(); } else { $language = explode( '_', $locale ); // "en" => ["en"], "ru_RU" -> ["ru", "RU"] return $language[0]; } } else { return $this->getCurrentLanguage(); } }
To
protected function getRestoreLanguage() { if ( is_admin() && ! MPHB()->isAjax() ) { return false; $locale = get_user_meta( get_current_user_id(), 'locale', true ); if ( empty( $locale ) ) { return $this->getDefaultLanguage(); } else { $language = explode( '_', $locale ); // "en" => ["en"], "ru_RU" -> ["ru", "RU"] return $language[0]; } } else { return $this->getCurrentLanguage(); } }
5) Clear all types of caches.
If the solution provided here does not resolve the issue or seems outdated, we encourage the client to check the related known issues, verify the version of the permanent fix, and confirm that the latest versions of themes and plugins are installed. If the problem persists, please open a new support ticket with us.
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.
This topic is split from https://wpml.org/forums/topic/flags-do-not-direct-to-translated-pages/
This topic contains 18 replies, has 2 voices.
Last updated by 1 year, 3 months ago.
Assisted by: Bigul.