• Resolved Beee

    (@beee)


    On this page I found 2 fitlers to redirect a user after login.

    I tested both (for login/logout) and they both worked. Which one is the best to use ??

    I only want to redirect a user to his/her account page (which varies per language), after successful login, not after other actions.

    function sd_redirect_to_profile() {
    
        return get_permalink( ACCOUNT_PAGE );
    }
    add_filter( 'tml_redirect_url', 'sd_redirect_to_profile' );
    // add_filter( 'login_redirect', 'sd_redirect_to_profile' );
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jeff Farthing

    (@jfarthing84)

    You can use either one, as you’ve found out.

    Thread Starter Beee

    (@beee)

    Correct, but I might overlook something, since I don’t know exactly what each filter does and I couldn’t find any info in the documentation on the website, hence why I ask.

    Since I only want to use it for successful login, would login_redirect then be the better choice ?

    Plugin Author Jeff Farthing

    (@jfarthing84)

    The only difference I can really think of off hand is that, being from WP core, login_redirect will still work without TML, using wp-login.php.

    Thread Starter Beee

    (@beee)

    That’s a good enough reason already ??
    And I just discovered the referring URL is also included, which is helpful, so login_redirect it is.

    Thanks for the reply, kudos on the speed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What is the preferred method for user redirection ?’ is closed to new replies.