This thread is resolved. Here is a description of the problem and solution.

Problem:
Language switcher not working in site home page

Solution:
The issue is related to a few Managed Hosting the site url and home url is not set properly in the database and managed by the server.
To resolvr, add the site_url and home_url constants in wp-congig.php

define( 'WP_HOME', 'https://site_domain.com/' );
define( 'WP_SITEURL', 'https://site_domain.com/' );

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 23 replies, has 2 voices.

Last updated by kruger-hotel-group-agA 9 months, 2 weeks ago.

Assigned support staff: Raja Mohammed.

Author Posts
September 19, 2019 at 7:35 am #4602029

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I have tested again language switcher works without any issue on the home page, I have recorded a small video please check the screencast hidden link .

Please clear any cache on your site, Test this on a new browser. If you still have an issue can you please record your steps you can use hidden link to capture your screen and share the link to me.

September 19, 2019 at 9:55 am #4603249

kruger-hotel-group-agA

as I already mentioned you earlier that "choose language" menu item is not language switcher by wpml ...that I have custom coded it is running fine..but I want to use WPML language swicher.

please enable the menu language switcher from wpml setting and then check..it is not enabled on the migrated site.

September 20, 2019 at 3:37 am #4609579

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Sorry about that, I have overlooked the issue.

I Just gave a second look in the issue, This is not happening in the cloudways clone, Please verify hidden link.

Probably this is specific to your installation or hosting. try increasing the WP memory limit the current value is 40MB, Minimum requirements are 128Mb:

https://wpml.org/home/minimum-requirements/

You can add this to wp-config.php to increase WP memory:


/** Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

- Add it above the line



/* That's all, stop editing! Happy blogging. */

The other difference I can see is you are under a managed hosting make sure the home page is not cache disable page caching if enabled already.

Let me know if that helps.

September 20, 2019 at 11:31 am #4611745

kruger-hotel-group-agA

but why this issue is only occurring on hompage for other pages menu language switcher is working fine.

only on homepage their is no a href link coming..on other pages it is coming.

please check again i think their is any other issue.

September 20, 2019 at 5:37 pm #4613907

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Since the issue cannot be reproduced on alternative server space. I am considering the issue would be related to any of server-specific parameters like memory limit or server-side cache.

Check if ther is any server-side cache enabled for your site try clearing and disabling it for the time being while to test the pages. Also, increase the memory limit as suggested earlier.

Also, I would recommend add a minor edit to site home page in the default language and try updating the translation, This will clear any process that is stuck in the middle.

If the issue still persists let me know. I would consider escalating this to the second tier of supporters

September 23, 2019 at 9:02 am #4621853

kruger-hotel-group-agA

I have asked the hosting to increase the wp memory limit as you suggested but the issue remain same..

WPML menu language switcher is still not working on homepage and working on other pages.

please if possible I want to take help with second tier of supporters to resolve the issue.

thank you.

September 23, 2019 at 9:03 am #4621863

kruger-hotel-group-agA

please also let them know for not checking the "choose language menu item" which I have customly created which is working fine on homepage.

ask them to add menu language switcher of wpml.

September 24, 2019 at 4:12 am #4627907

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I can still see the wordpress memory limit is still 40MB from WPML > Support section. are you sure whether the below code is added in the site wp-config.php file

/** Memory Limit */
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );

Also please make sure server-side caching is disabled on your server. You can pass on the cloned site to the hosting provider for reference where the switchers work fine hidden link.

The custom switchers are static there won't be an issue with it. The issue here is the WPML language switcher function is being interrupted.

I would request you consider upgrading the PHP to version 7 or above, the clone site uses the same. Though our minimum requirement is PHP 5.6 which is the version used in your site However we recommend PHP version 7 or above for smooth functioning.

Let me know these details, which is required for proper escalation to the second tier.

Kind regards
Raja

September 24, 2019 at 11:16 am #4630933

kruger-hotel-group-agA

I have increased the wp memory limit and upgrade php version also.

I have disable the server side caching also.

but issue is still as it was before.

wpml menu language switcher is not working on homepage.

please check it again.

September 25, 2019 at 9:54 am #4637479

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks for the information the issue seems to be related to a few Managed Hosting including Godaddy.
Oh yes! this one skipped my mind. It is an issue caused by the restricted site and home URL values that can only be changed from the managed hosting control panel.

Try adding the below code to the wp-config.php file


define( 'WP_HOME', '<em><u>hidden link</u></em>' );
define( 'WP_SITEURL', '<em><u>hidden link</u></em>' );

I hope this should solve your issue.

Kind regards
Raja

September 27, 2019 at 6:50 am #4651915

kruger-hotel-group-agA

Thank you soo much Mr.Raja Mohammed..you are great..

the issue is resolved now.

thank you.

September 27, 2019 at 6:52 am #4651919

kruger-hotel-group-agA

My issue is resolved now. Thank you!