Viewing 1 replies (of 1 total)
  • Plugin Support Amrit Kumar Shrestha

    (@shresthauzwal)

    Hi @yolo5811,

    Thank you for writing in,

    Could you please install the https://wordpress.org/plugins/code-snippets/ plugin on your site and add the following code to it and activate the code snippets. This plugin will help you to secure the custom modification on the plugin.

    Or you can add the following code on your themes functions.php file.

    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;
    }

    Regards!

Viewing 1 replies (of 1 total)
  • The topic ‘Redirect User to Previous Active Page’ is closed to new replies.