Hi @wjyeshealth,
We are really sorry for the delayed response. Here is the code that you need to paste in your active theme’s functions.php file at the end and hope it will do a trick.
add_action( 'user_registration_before_registration_form', 'ur_set_register_redirect_url' );
function ur_set_register_redirect_url( $form_id ) {
if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
set_transient( 'originalLoginRefererURL', $_SERVER['HTTP_REFERER'], 60 * 60 * 24 );
}
}
add_filter( 'user_registration_redirect_from_registration_page', 'ur_register_redirect_back', 10, 2 );
function ur_register_redirect_back( $redirect, $user ) {
if ( true === ( $redirect_url = get_transient( 'originalLoginRefererURL' ) ) ) {
delete_transient( 'originalLoginRefererURL' );
error_log( print_r( $redirect_url, true ) );
return $redirect_url;
}
return $redirect_url;
}
Let me know whether it helps or not and I will get back to you.
Thanks and Regards!