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 thread is resolved. Here is a description of the problem and solution.

Problem:

The language selector automatically redirects to the home page.

Solution:

The client is using Superfly Menu + Superfly Menu Toolbar's built-in language switcher. The plugin is calling the wpml_active_languages filter too early.

-edit the file wp-content/plugins/superfly-extension-toolbars/src/Frontend/SFET_Frontend.php line 90 to:

add_action('wp', array($this, 'init_lang_switcher'));

This topic contains 15 replies, has 2 voices.

Last updated by elisabethL-2 4 months, 3 weeks ago.

Assigned support staff: Dennis.

Author Posts
April 29, 2019 at 4:47 pm

elisabethL-2

I am trying to: The language selector automatically redirects to the home page. How to make it redirect to the current page?

April 30, 2019 at 6:59 am #3708385

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Welcome to WPML Support forum.

It seems that the language switcher came from your theme. As a test, could you please try to configure/add a WPML footer language switcher?

https://wpml.org/documentation/getting-started-guide/language-setup/language-switcher-options/

Using the WPML footer language switcher, try to switch languages. Does it points you to the right page?

Please let me know your results.

Thank you.

Kind regards,
Dennis

April 30, 2019 at 7:08 am #3708497

elisabethL-2

Yes, the WPML footer language switcher points to the right page. But not the one in the menu... Do you have a solution ?

April 30, 2019 at 9:42 am #3710163

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

I would like to request your permission to install Duplicator plugin, build a package and download a copy so I can continue debugging locally and without affecting your site. Please let me know if I can proceed.

Thank you.

Kind regards,
Dennis

April 30, 2019 at 9:45 am #3710173

elisabethL-2

Yes no problem

April 30, 2019 at 10:18 am #3710309

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

I have successfully created a duplicator package. I will download a copy and try deploy it on my local machine. Then I will continue debugging your site locally and will give you feedback when I got some results.

Kind regards,
Dennis

May 2, 2019 at 4:16 am #3721551

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

This seems to be a compatibility issue with your Superfly Menu + Superfly toolbar plugin. To confirm this, we have to reproduce the issue on a clean install so I have created a test site for you. You can now access it using the link below.

hidden link

Could you please upload just your Superfly Menu + Superfly toolbar plugins, if possible try to replicate the issue. You do not have to recreate your site, just install the minimum necessary to reproduce the problem.

Please let me know once done so I can go and check. If you have any questions please let us know.

Thank you.

Kind regards,
Dennis

May 2, 2019 at 6:41 am #3722131

elisabethL-2

Hi,
Uploading Superfly Menu + Superfly toolbar plugins done

May 2, 2019 at 7:43 am #3722381

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your updates.

I have replicated the issue on our test server (clean install). I will escalate this issue to our compatibility team for further investigation. I will get back to you when I have a feedback from our compatibility team.

Kind regards,
Dennis

May 17, 2019 at 7:31 am #3831817

elisabethL-2

Hi Dennis, still no solution to the problem?

May 17, 2019 at 7:52 am #3831931

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

I got a feedback from our compatibility them and they suggested to contact the plugin author about this issue since the language switcher was implemented by the plugin by activating it from Superfly Menu > Menu Panel tab > Toolbar tab, tick the ' Language Switcher (WPML)' option.

Kind regards,
Dennis

May 17, 2019 at 8:15 am #3832143

elisabethL-2

I already did it, that's their answer :
Hi, we're using WPML plugin's API, and URL field is getting for pages https://wpml.org/wpml-hook/wpml_active_languages/.
So this issue is related to WPML functions.

...

May 17, 2019 at 8:52 am #3832513

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for your reply.

I have updated our compatibility team with the author's reply. I will update you when I got a feedback from them.

Kind regards,
Dennis

May 20, 2019 at 8:35 am #3844883

Dennis
Supporter

Languages: English (English )

Timezone: Asia/Manila (GMT+08:00)

Hi,

Thank you for waiting.

It seems that the plugin is calling the wpml_active_languages filter too early.

Could you please edit the file wp-content/plugins/superfly-extension-toolbars/src/Frontend/SFET_Frontend.php line 90 to:

add_action('wp', array($this, 'init_lang_switcher'));

Does it help? Please let me know.

Kind regards,
Dennis

May 20, 2019 at 8:50 am #3845053

elisabethL-2

Yes it's perfect, it works! Thanks a lot Dennis ^^