• I have a function in my child theme’s functions.php file which redirects visitors to a certain page once they successfully log in. It’s working fine.

    I’m trying to add an additional function which won’t interfere with the existing function that would redirect visitors to a alternative page if they’ve reached the login page from a different “referring” page.

    Here’s my existing function that’s working for the first redirect:

    function login_redirect( $redirect_to, $request, $user ){
    
        return home_url('/my-page');
    
    }
    
    add_filter( 'login_redirect', 'login_redirect', 10, 3 );

    Is there something I could add or tweak so that it “pays attention” to how they got to the login page and then sends them somewhere else?

    Hope this makes sense. :-/

  • The topic ‘Function help for redirect after login based on referring link’ is closed to new replies.