Hi @evangelismcoach, @leveluphop,
If you want your users to redirect to the same page they clicked on then you need to paste the provided code in your active theme’s functions.php file and it will do the trick.
Here is the code:
//Redirect back to the previous page after login**************
add_action( 'user_registration_before_customer_login_form', 'ur_set_redirect_url' );
function ur_set_redirect_url() {
if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
set_transient( 'originalLoginRefererURL', $_SERVER['HTTP_REFERER'], 60 * 60 * 24 );
}
}
add_filter( 'user_registration_login_redirect', 'ur_redirect_back', 10, 2 );
function ur_redirect_back( $redirect, $user ) {
if ( true === ( $redirect_url = get_transient( 'originalLoginRefererURL' ) ) ) {
delete_transient( 'originalLoginRefererURL' );
return $redirect_url;
}
return $redirect_url;
}
Let me know if it works for you not and I will get back to you.
Regards!