weglot_navigator_language
With this filter you can modifiy the browser language(s) detect by Weglot.
Lets you change the list of browser languages Weglot reads from the visitor to decide the redirect language. Useful together with a custom language code.
The filter receives the browser languages as lowercase codes, in the visitor's order of preference (for example array( 'zh-tw', 'en' )), and must return the list. Weglot compares them with your language codes in lowercase.
add_filter( 'weglot_navigator_language', 'custom_weglot_navigator_language' );
function custom_weglot_navigator_language( $navigator_languages ) {
return $navigator_languages;
}For a complete example that maps a browser language to a custom code, see Use custom language code.
Last updated