Redirect depending on selected language
-
I’m trying to write a function to redirect upon woocommerce login, depending on the currently selected language. However, I’m not familiar with PHP. Should this work Polylang?
function filter_woocommerce_login_redirect( $redirect, $user ) { let $current_language; if ( function_exists('pll_current_language') ) { $current_language = pll_current_language(locale); } let $redirect = '/foo-one/'; if ( $current_language == 'fr' ) { $redirect = '/foo-two/'; } else if ( $current_language == 'es' ) { $redirect = '/foo-three/'; } return $redirect; };
- The topic ‘Redirect depending on selected language’ is closed to new replies.