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 1 reply, has 2 voices.

Last updated by Riffaz 4 weeks ago.

Assigned support staff: Riffaz.

Author Posts
September 19, 2019 at 10:44 am #4603745

emilK-6

Hi WPML,

I'm currently using the option, redirect based on browser language, but I would like to change it to only work on the front page of my site.

So if a user find a link to a subpage or blogpost etc, they are not redirected. Can't seem to find any options in the plugin that does it.

Can you help me set it up? The page is: hidden link

/Emil

September 19, 2019 at 4:17 pm #4607289

Riffaz
Supporter

Languages: English (English )

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

Hi,

Thank you for contacting WPML Support

I'm afraid that is not a feature of wpml yet, and such a script would need custom coding which is beyond the scope of our support. This being the case please consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/
You will get the custom assistance you need to get on with your project.
Before doing so please have a look also here: http://wpml.org/documentation/support/wpml-contractors/guidelines-for- people-looking-for-consulting-help/

Please see in the attached screenshot the possibilities of language redirection included in WPML: ( https://wpml.org/wp-content/uploads/2013/04/browser-language-redirect1.png )

1. Disable browser language redirect (Obvious: WPML will not redirect users)

2. Redirect visitors based on browser language only if translations exist (Only redirects to translation if they exist, otherwise default language is loaded)

3. Always redirect visitors based on browser language (Redirect to home page if translations are missing)

Please also consult this DOC:
http://wpml.org/documentation/getting-started-guide/language-setup/automatic-redirect-based-on-browser-language/

We have a list of WPML hooks that can help you develop such feature, which can be seen in the links below:

- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference

If you prefer, you can contact one of our certified partners who can develop small to large features for your site: http://wpml.org/documentation/support/wpml-contractors/

We are not providing the custom code here, this would be done either by you or any other Programmer you employ for it.

Usually the provided solutions are through filters and actions so you don't loose custom code after WPML Update

As a example, adding this to functions.php in your child-theme:

if ( !is_front_page() ) {
  remove_action('init', array('WPML_Browser_Redirect', 'init'));
}

==> if functions.php runs after the plugin, will disables the WPML action (WPML_Browser_Redirect")
and then you would create a new one (custom code) in the child.

This way, any Update to WPML would not make effect to your custom code.

I hope I explained the process understandable

Please, let me know if I can help with any other questions you may have about it. I'll be happy to help.

Thanks,
Riffaz.