• Hi there,

    I just update the WordPress version and theme my login version.

    Unfortunately, now after general user login they are redirected to the login page again but with a successful login state, and for admin they automatically go to the admin dashboard page.

    I have some codes on functions.php which works fine previously, but now it seems doesn’t even go to this function.

    add_filter( 'login_redirect', 'My-Custom-Login', 10, 3 );
    function My-Custom-Login( $redirect_to, $request, $user ) {
        if( isset( $_REQUEST['redirect_to'] ) ) {
            return $_REQUEST['redirect_to'];
        } else {
        	$redirect_to = '/select-item/';
        }
    
        return $redirect_to;
    }

    Do I need to do something after the latest update?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    I don’t believe you can use hyphens in PHP function declarations. Try replacing those with underscores.

    Thread Starter alvinlan

    (@alvinlan)

    Hi there,

    Of course not, I just changed the function name when I paste it here. I use underscores for the function name.

    Now, all normal login will go to the dashboard page, which not following the function that works previously. Is this filter cannot be used anymore when we use theme-my-login?

    N.b. for now, I just changed the default dashboard page to another specific page to cope with this situation.

    Plugin Author Jeff Farthing

    (@jfarthing84)

    Try using a priority of at least 101 instead of 10.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Login Redirection’ is closed to new replies.