Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

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 contains 13 replies, has 3 voices.

Last updated by Andrés 4 years ago.

Assigned support staff: Andrés.

Author Posts
December 10, 2015 at 6:13 am #765435

Richard

Hi,

The language switcher code has stopped working. It may have stopped with version 3.3.1, but not certain.

I then updated to WordPress 4.4, to see if that fixed anything but it did not.

I then went to the WPML admin and saw that the do_action code was changed.

My theme previously used:

<?php do_action('icl_language_selector'); ?>

But I saw that WPML->Languages says to now use:

<?php do_action('wpml_add_language_selector'); ?>

I made this change in my theme expecting everything to be fixed, but it did not.

If I view source, this is the output that is in the space that should be the selector.

<div id="lang_sel"><ul><li><a href="#" class="lang_sel_sel icl-"></a></li></ul></div>

Please help.

Thank you,
Richard Cook

December 10, 2015 at 6:33 am #765442

Richard

FYI,

I tried changing the switcher style to Mobile Friendly Always and Mobile Friendly Mobile Agents Only, and this caused a dropdown to show up (mac laptop), but it did not work. I click on it, and only English shows up, when I previously had 3 languages show up, English/Chinese Traditional/Chinese Simplified.

I now realize that, when the switcher shows up on my homepage (mobile friendly always, classic nothing shows), It is only showing English. Previously it use to show all three languages, and I could switch to the other sites (I have different domains for each language).

I went to one of my Chinese sites (.cn), and went to a single post page. The switcher appears with all 3 languages in it as expected, and I can switch to another language from here. If I go to the English version though, then the switcher only shows English.

If I go to the homepage (.cn site), the switcher is there, but the links are wrong. Instead of linking to the homepage for the different languages (.com, .cn, .tw), it is showing a link for an older single post.

So basically, I think somebody munged up the switcher code.

Rich

December 10, 2015 at 6:41 am #765446

Richard

If you want to see the weird behaviors, you can visit the following sites. I set it back to Classic though.

Look for dropdown in right sidebar.

hidden link (dropdown is shown with broken links to random post on homepage)
hidden link (dropdown is shown with correct links to other homepages)
hidden link (no dropdown is shown)

December 10, 2015 at 4:55 pm #766179

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

Timezone: Europe/Paris (GMT+01:00)

Hello Richard,

Welcome to WPML support forum.

Unfortunately, I'm not able to reproduce this behaviour. I have visited your .com domain and it displays the three languages, for example. Can you please tell me if you were able to solve this issue?

On the other hand, I see you have W3TC installed, please be aware of emptying your cache.

You can also try the following, on the case you still have some cache issues:
1. Backup completely your site.
2. Go to:
- WPML > Support.
- Click on 'troubleshooting' link.
- Click on the 'Clear the cache in WPML' button.
- Click on the 'Remove ghost entries from the translation tables' button.
- Click on the 'Set language information' button.

Best regards,
Andrés

December 10, 2015 at 6:22 pm #766274

Richard

I am able to reproduce this currently on my site.

I do not see the switcher, when I'm logged in. I also opened an icognito window where I am not logged into WP, and it does not appear there as well.

I cleared my caches yesterday while testing, so that was not the issue at that moment.

Please see attached screenshot.

December 10, 2015 at 6:55 pm #766301

James

Signing up here as we have similar problems on our site.

- language switcher occasionally missing (specifically: no <a> text for current language)
- language switcher (and hreflang tags) pointing to wrong pages initially, and to home page (incorrect) after performing the troubleshooting steps described above - possible SEO nightmare.

No choice but to revert to previous version. This is after a week dealing with an issue with the last WPML release!!! Very frustrated now guys!!!

Look forward to updates here. I have replicated the issue on a barebones WP install if you need any input debugging.

For info, we're hosted at WPEngine (who cache heavily), running WP 4.4 with all plugins up to date.

James

December 10, 2015 at 6:57 pm #766302

James

Also - please advise if we are supposed to have changed from to icl_language_selector to wpml_add_language_selector as I received no notification of this.

December 10, 2015 at 7:07 pm #766311

Richard

James,

I believe wpml_add_language_selector should be used. The WPML Language selector section in the admin says to use it, and I also see this in the code.

/**
 * @since      unknown
 * @deprecated 3.2 use 'wpml_add_language_selector' filter instead
 */
function icl_language_selector() {
	global $sitepress;

	return $sitepress->get_language_selector();
}

/**
 * Display the drop down language selector
 * @since 3.2
 * Will use the language selector include configuration from the WPML -> Language admin screen
 * @use \SitePress::api_hooks
 * example: do_action('wpml_add_language_selector');
 */
function wpml_add_language_selector_action() {
	global $sitepress;

	echo $sitepress->get_language_selector();
}
December 10, 2015 at 7:30 pm #766323

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

Timezone: Europe/Paris (GMT+01:00)

Both semantics are valid, icl_language_selector and wpml_add_language_selector. We started a migration progress since our 3.2 update but we are not planning to eliminate our previous hook. But we are trying to encourage users to use our new API:
https://wpml.org/documentation/support/wpml-coding-api/

However I don't think this issue (that I can replicate now), it is associated to the hook but to WPML 3.3.3 update.

I would like to request temporary access (wp-admin and FTP) to your test site to take better look at the issue, could you please indicate me how to replicate this behaviour ?

You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this I’ll need to temporarily install a plugin called “Duplicator” on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok for you.

*Important: Be sure to backup your site and database first before you proceed!
You can use a plugin for this if you like. You can use the Duplicator plugin for this purpose.
See: http://wordpress.org/plugins/duplicator/

Privacy and Security when Providing Debug Information for Support:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

December 10, 2015 at 7:32 pm #766328

James

Thanks Richard (@awhig).

I don't remember seeing any notification of this so hopefully we can assume the old code still works and it's not to do with that.

Our language switcher is inserted via do_action('icl_language_selector') in header.php, but on the barebones test WP install I used the Language Switcher Widget and the result was the same.

James

December 11, 2015 at 12:11 pm #766886

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

Timezone: Europe/Paris (GMT+01:00)

You can paste the downloadable links in the next message which will be private, Richard.
Thanks for your help.

December 11, 2015 at 10:19 pm #767487

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

Timezone: Europe/Paris (GMT+01:00)

Hello Richard,

Unfortunately I couldn't install it locally, I had a 500 error every time. Fortunately we have a new CMS Beta Package, version 3.3.4-b2, that should include a fix for this issue, and we are expecting a new version for first days of next week.
https://wpml.org/account/downloads/

Could you please tell me if that this Beta version solves your issue?

Best regards
Andrés

December 15, 2015 at 6:05 pm #769864

Richard

I see other people are reporting the same issues with the language switcher in the latest release.

I will wait for the new release. I do not want to install a beta version on my live site.

Thank you,
Rich

December 15, 2015 at 7:36 pm #769955

Andrés
Supporter

Languages: English (English ) Spanish (Español ) French (Français )

Timezone: Europe/Paris (GMT+01:00)

I completely understand your position, Richard. We hope it is going to be release soon.
However, there is something you can try. As it seems that this bug is associated to cache, could you please empty your cache from W3TC plugin and temporary disable it?

Does your language switcher start working correctly?

Regards,
Andrés.

The topic ‘[Closed] Upgraded to latest WPML and the language switcher stopped working’ is closed to new replies.