• Resolved oguruma

    (@oguruma)


    I am using the Leaky Paywall Plugin, so I need a way to redirect users back to the post they clicked through to the login page from (a custom redirect set in the plugin will not work, since they could have clicked through from any posts).

    I tried the snippet below, which I think would work on the default wp-admin login, but doesn’t work via the UWP Login.

    `add_filter(‘login_redirect’, ‘redirect_previous_page’, 10, 1);

    function redirect_previous_page( $redirect_to ){
    global $user;

    $request = $_SERVER[“HTTP_REFERER”];

    if ( in_array( $user->roles[0], array( ‘administrator’) ) ) {

    return admin_url();

    } elseif ( in_array( $user->roles[0], array( ‘subscriber’) ) ) {

    return $request;
    }

    return $redirect_to;
    }’

    Is there any way to send Subscribers back to the referring page?

Viewing 1 replies (of 1 total)
  • Hi,

    Can you try our own filter “uwp_login_redirect” instead of “login_redirect” and let me know if it works for you or not?

    Regards,
    Patrik

Viewing 1 replies (of 1 total)
  • The topic ‘Login Redirect To Referrer?’ is closed to new replies.