Autoswitch System: Server-Side and Client-Side implementation
Weglot uses an auto-switch mechanism to automatically redirect users to the correct language version of the site based on their browser settings .
1. Disable the server-side auto-switch
2. Enable the client-side auto-switch
function custom_weglot_empty_selectors( $selectors ) {
return [];
}
add_filter( 'weglot_whitelist_selectors', 'custom_weglot_empty_selectors' );
add_filter( 'weglot_dynamics_selectors', 'custom_weglot_empty_selectors' );
add_filter( 'weglot_translate_dynamics', '__return_true' );
add_filter( 'weglot_allowed_urls', function () {
return 'all';
} );
add_filter( 'weglot_autoredirect_js', '__return_true' );Last updated