Skip Navigation

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.

Tagged: 

This topic contains 18 replies, has 2 voices.

Last updated by Bigul 1 year, 2 months ago.

Assisted by: Bigul.

Author Posts
February 8, 2024 at 2:18 pm #15281723

goncalod

Hi Bigul,

So I followed the tutorial to get my menus Sycronized as per https://wpml.org/documentation/getting-started-guide/translating-menus/#easy-customizable-wp-menus-sync and followed all the steps on Easy & Customizable - Use WPML’s WP Menus Sync.

it did not synchronize the menus, It broke the header again, rolled back to an odd format on the footer (turning it white), And placed different menus on the English language page. The French front page is also out of format, again. The footer on this page is completely off.

German front page, for some reason the menu now is sticky.....
I mean, for something that should be just "plug and play" this whole process is getting annoying.
I'm trying to work on the website, trying to get things done, and create content, and I'm faced with a never-ending amount of bugs...
I gave you guys plenty of opportunities to fix everything. Every time i try to do something with WPML I find another bug...

I'm lost for words.

Need a bit of guidance here. Please, please, please, see what's wrong with your API and why the jobs don't Sync, why there are errors on the jobs editor, Why I can´t delete jobs that I assign and keep on getting errors...

Videos of all the bugs I Found:

Menu auto - fills after 30-40 seconds.
hidden link

February 8, 2024 at 5:02 pm #15282494

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

I am currently testing this bug on my local copy and get back to you soon. Please wait.

--
Thanks!

Bigul

February 13, 2024 at 3:27 pm #15298675

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Sorry for the late response because of the weekend and we were testing other problems of the site in our local copy.

Please check the attached images. We are not able to reproduce the issue exactly in the local copy. Therefore try the following troubleshooting steps after a full site backup{mandatory} and make sure the issue exists or not.

1) Go to WPML>>Support page, click on the Troubleshooting link (blue link in the middle of the page)

2) On the Troubleshooting page, please click on the following options of the *Clean up* section. Wait for confirmation of processing after each one.

- Clear the cache in WPML
- Remove ghost entries from the translation tables
- Fix element_type collation
- Set language information
- Fix WPML tables collation
- Assign translation status to duplicated content
- Fix terms count
- Fix post type assignment
- Cleanup and optimize string tables

--
Thanks!

Bigul

2024-02-13_20h55_00.png
2024-02-13_20h50_33.png
February 14, 2024 at 9:13 pm #15304412

goncalod

Hi Bigul. thanks for your time. So, what shows on the life site is not whats appears on the menus. None of the menus populate the translations.

Am I missing something. The menu's on the live website do have a translated version on the portuguese menu.
Also, I don't know where does WPML get the original source for the translation. As you can see it looks like the menu's in the different languages do not populate.

See the video below.

Kr

hidden link

February 15, 2024 at 8:45 am #15305536

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the feedback. Somehow the Header menu is not translated correctly to the secondary language on the live site. It may be a compatibility issue.

So just to make sure, have you created the menu in the Portuguese language from Appearance>>Menus, or have you created it from an Elementor Template?

Most probably you can resolve the issue by deleting the translated Menus one by one. Then translate the Menus manually to secondary languages. Please refer to the following documentation for more details. But take a full site backup{mandatory} before these steps.

https://wpml.org/documentation/getting-started-guide/translating-menus/#fully-custom-create-menus-manually

--
Thanks!

Bigul

February 15, 2024 at 10:52 am #15306455

goncalod

Hi Bigul! I´ve done both methods. I created the menu's on Aperance -Menus.
Created the original one in Portuguese in the Portuguese website. After that I create the other menus using different methods, namely:
Individualy created each menu for each language. Did not work.
Created Menu in English, in the english website - did not work.
Created Portuguese and then set to translate and Sync automatically using WPML login and the tutotrial mentioned above.
Still no joy.
Tried doing the same with the english language, did not work.

Just to repeat I did, again last night, step by step of this tutorial : https://wpml.org/documentation/getting-started-guide/translating-menus/#easy-customizable-wp-menus-sync In both Portuguese and english language. Still no joy.

The menu in the different languages just seem to populate on the live site, and not on the Apearence - Menu side of things.

Even if I create them they do seem not to display correctly on the website.
Thanks

February 16, 2024 at 7:49 am #15310246

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the feedback. We will debug it further. Just to make sure have you tried those steps after the WPML Troubleshooting procedures suggested in the following thread. Please confirm.

https://wpml.org/forums/topic/easy-and-customizable-use-wpmls-wp-menus-sync-feature-is-not-working/#post-15298675

--
Thanks!

Bigul

February 19, 2024 at 9:56 am #15317120

goncalod

Hi! Yes, i followed the steps mentioned. Still no luck 🙁

February 19, 2024 at 6:53 pm #15319894

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. I have created a new duplicator copy of the site. We are currently working on it and will get back to you soon. Please wait.

--
Thanks!

Bigul

February 20, 2024 at 9:14 am #15321117

goncalod

So, I found that the the menu´s are populating according to the page's name. Menaning, ig a page is called list the menu will populate with this. So in order for me to change the menu's names on the header I have to change the page's name in the respective language.

The menus still don't show on the Appearance -Menus- English, french....

February 20, 2024 at 9:37 am #15321323

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. One request. It would be great if you could share a screencast about the following. It will greatly assist us in troubleshooting and also in our internal communication.

So, I found that the the menu´s are populating according to the page's name. Menaning, ig a page is called list the menu will populate with this. So in order for me to change the menu's names on the header I have to change the page's name in the respective language.

--
Thanks!

Bigul

February 20, 2024 at 3:28 pm #15323772

goncalod

Please see Dropbox link.

None of the menu structure makes sense. hidden link

February 22, 2024 at 11:40 am #15333229

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Thank you for the updates. We are still working on this and get back to you as soon as possible. Please wait.

--
Thanks!

Bigul

February 26, 2024 at 11:41 am #15343876

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

The bug exists after the initial troubleshooting procedures. So I am consulting with our second-tier team for an expert opinion. We will get back to you as early as possible. Please wait. Thank you for your patience.

--
Thanks!

Bigul

March 1, 2024 at 3:46 pm #15363739

Bigul
WPML Supporter since 01/2013

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

This bug is happening because of a compatibility conflict with the MotoPress Hotel Booking plugin. The following function of the wp-content/plugins/motopress-hotel-booking/includes/translation.php(line 315) always returns *en-us* as 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.

	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();
		}
	}

We are getting the expected result when we add a return before the following line.

$locale = get_user_meta( get_current_user_id(), 'locale', true );

So one request, can you please report this issue to the MotoPress Hotel Booking team? We are happy to assist them to fix this issue.

Please check it and let us know your feedback.

--
Thanks!

Bigul