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 .
function custom_weglot_dynamics_selectors( $default_dynamics ) { return []; } add_filter( 'weglot_dynamics_selectors', 'custom_weglot_dynamics_selectors' ); add_filter( 'weglot_whitelist_selectors', 'custom_weglot_dynamics_selectors' ); add_filter( 'weglot_translate_dynamics', '__return_true' ); add_filter( 'weglot_allowed_urls', function( $urls ) { return 'all'; });add_filter( 'weglot_autoredirect_js', '__return_true' );$js_autoswitch = apply_filters( 'weglot_autoredirect_js', false );
Last updated