Resolved
Reported for: WPML Multilingual CMS 3.6.1
Resolved in: 3.6.1
Overview of the issue
Sometimes, not all menus that exist in your site will be listed in the dialog to add a language switcher to a menu. Additionally, the language switcher is missing in the menu of secondary language.
Workaround
This issue occurs with old installs where the term_id is not always equal to the term_taxonomy_id.
The problem will be fixed in a future release. Meanwhile, it is possible to manually patch the currently released version.
Step 1
Edit the file wp-content/plugins/sitepress-multilingual-cms/classes/language-switcher/class-wpml-ls-settings.php on the line 267 and replace:
$menu_details = $this->sitepress->get_element_language_details( $menu->term_id, 'tax_nav_menu' );
With:
$menu_details = $this->sitepress->get_element_language_details( $menu->term_taxonomy_id, 'tax_nav_menu' );
Step 2
Edit the file wp-content/plugins/sitepress-multilingual-cms/classes/translations/class-wpml-menu-element.php on line 27 and replace:
return new WPML_Menu_Element( $element_data->element_id, $this->sitepress, $this->wpml_cache );
With:
return new WPML_Menu_Element( $element_data->term_id, $this->sitepress, $this->wpml_cache );
Applying this fix makes the language switcher appearing in the primary language pages only, not in secondary languages…
Same thing here. I also updated the plugin to 3.6.1 as recommended in other threads
Hi @yvesP-3 and @pabloV-7,
We are aware of this second issue and we are working in it. We will update this errata as soon as we have a valid fix for it. Sorry the inconvenience!
I’ve tried to patch. Step 1 and 2. Also removed and added the language switcher.
Still not showing up for me?
Hi @laureneD,
Your problem might be somehow different. Could you please open a ticket on our support forum https://wpml.org/forums/forum/english-support/?
Hmm ok. Done that: https://wpml.org/forums/topic/language-switcher-is-gone-after-update/. Thanks Pierre.
Thank you. It seems all works well now.
Please, is there anything that I will have to do the next time that I will update your great plugin?
Ciao
Thank you for your feedback @Enrico!
This was a bug and the patch will be included in the next WPML version.
Hello Pierre,
Not feeling save to apply the patch. When will the next update be?
Tony
This week we’re closing all issues and doing testing. An update will be ready by next week.
WPML supporters are following this process for all reported bugs:
1. Get the description from the client
2. Provide a patch / beta version
3. Get confirmation from the client that it’s working
4. If not, escalate again to development with additional debug info
I want to make sure that the solution that we have now works on your site. This will tell us that there aren’t cases that we’re not aware of. In the support thread where you got help for this (probably mentioned this errata), please ask the supporter to send you a development version with this fix. If you’re not comfortable enough to apply these fixes (which makes sense), WPML support will send you a ZIP file that includes the fixed version.
Would you be able to do this? If you’re applying a dev version and still getting that problem, we need to know about it, so that we can check why and get it working for you too.
Thank you, BUT…
these substitutions show me and let me choose my “Main” menu in the new switcher menu language (I could not see it before), then the drop-down menu works properly on the site.
But when I change the language, I can not get the product page (based on Woocommerce plugin):
the (correct) links lead to a page 404 (but they were ok before, this site has been online since 2014).
While the default language always works properly in all the site.
Are there some more issues with the “URL format language”?
In my case the first choice “Different languages in directories”.
My customer is sharpening its knives…!
Thanks for your assistance
cheers
Andrea
Hello Andrea and thank you for your feedback!
I suppose you are experiencing a different issue. Can you please open a ticket on the support forum? You will get a more dedicated assistance.
Pierre, in the mean time is it possible to re-install (temporarily) a previous version of the plugin, or the last version made some changes in the database?
thanks
Andrea
Andrea,
We usually have some migration logic performed during the plugin update. Nevertheless, I think it should be OK. But to be honest, I can’t confirm 100% that downgrading will not affect your install.
If you really want to downgrade, please take a full site backup previously.
No solution, the db apparently works with 3.5.3.1 version but the issue with the woocommerce products still remain.
But I actually don’t know how long the site has been affected by this issue.
I will open a ticket.
Thanks
Regards
Andrea
I restored a backup, the easyer way to have the site working, waiting for a new release of the plugin (to be tested in a test site!)
cheers
Andrea
Hi,
On my side, the patch (with the 2 steps) solves the language switcher menu display in both primary and secondary language pages. However, it doesn’t save the “Uncaught exception” fatal error issue as I explain in https://wpml.org/forums/topic/update-and-uncaught-exception/page/2/#post-1150891.
Maybe this is a completely different issue?
Thanks,
Yves.
Hi yvesP-3,
It’s hard to say. If you applied the full patch, it could be an issue specific to your install. In order to investigate this (and if not already done), could you please open a ticket on the support forum?
Thank you!
OK Pierre. The problem shows on Buddypress pages only, so maybe it is related to the Buddypress Multilingual pages. I go on on the support forum…
Thanks!
Those two steps solves issue on my site: both primary language (Lithuanian) and secondary language (English) shows correct language switcher in menu.
Thanks!
Using WordPress 4.7 and WPML 3.6.1 with all up-to-date components.