Dear @robuph
To redirect to a specific page after login, write a custom redirection function. Currently, there is no built-in feature and a plugin isn’t available.
Thank you.
Thread Starter
robuph
(@robuph)
can you please help me with the custom function please. I am not good with writing.
-
This reply was modified 1 year, 12 months ago by
robuph.
Dear @robuph
You can try this code snippet.
function custom_login_redirect( $redirect_to, $request, $user ) {
// Check if the user is logging in from a Tutor LMS page
if ( function_exists( 'tutor_utils' ) && tutor_utils()->is_tutor_checkout_page() ) {
// If so, redirect to the checkout page after login
return wc_get_checkout_url();
}
// Default to the standard redirect behavior
return $redirect_to;
}
add_filter( 'login_redirect', 'custom_login_redirect', 10, 3 );
// Define a function to modify the registration redirect URL
function custom_registration_redirect( $redirect_to ) {
// Check if the user is registering from a Tutor LMS page
if ( function_exists( 'tutor_utils' ) && tutor_utils()->is_tutor_checkout_page() ) {
// If so, redirect to the checkout page after registration
return wc_get_checkout_url();
}
// Default to the standard redirect behavior
return $redirect_to;
}
add_filter( 'registration_redirect', 'custom_registration_redirect' );