admin管理员组

文章数量:1289508

I have 2 registration pages, one for Korean, and one for English. The Korean registration is okay. The page /register is redirect to /checkout page. (registration leads to subscription based) after the registration.

On the other hand, the English registration page /register-eng is supposed to redirect to /checkout/?lang=en page. but after the registration, /register-eng also redirects to the same /checkout page.

Is there any apply_filter function to force redirect my English registration page to /checkout/?lang=en page?

Thanks in advance.

Test this code, but failed.

add_filter( 'registration_redirect', 'my_redirect_home' );
function my_redirect_home( $registration_redirect ) {
    global $post;
    $post_slug=$post->post_name;
    if( 'register-eng' === $post_slug ){
        $registration_redirect = '/?lang=en';
    }
    return $registration_redirect;
}

I have 2 registration pages, one for Korean, and one for English. The Korean registration is okay. The page /register is redirect to /checkout page. (registration leads to subscription based) after the registration.

On the other hand, the English registration page /register-eng is supposed to redirect to /checkout/?lang=en page. but after the registration, /register-eng also redirects to the same /checkout page.

Is there any apply_filter function to force redirect my English registration page to /checkout/?lang=en page?

Thanks in advance.

Test this code, but failed.

add_filter( 'registration_redirect', 'my_redirect_home' );
function my_redirect_home( $registration_redirect ) {
    global $post;
    $post_slug=$post->post_name;
    if( 'register-eng' === $post_slug ){
        $registration_redirect = 'http://example/checkout/?lang=en';
    }
    return $registration_redirect;
}
Share Improve this question edited Aug 5, 2021 at 14:26 Buttered_Toast 2,8191 gold badge8 silver badges21 bronze badges asked Jul 24, 2021 at 12:00 Healing for a minuteHealing for a minute 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

If you are using WPML you can use its built-in language condition statement.

if(ICL_LANGUAGE_CODE=='en')

Therefore you can put your redirect function in this.

if(ICL_LANGUAGE_CODE=='en'){
    // Your function
}

本文标签: Redirect after the registration