Support » Plugin: Active Directory Integration » Bad redirection at the first login

Viewing 2 replies - 1 through 2 (of 2 total)
  • T Klein

    (@tklein87gmailcom)

    Use this in functions.php:

    // redirect the users on login to the homepage (otherwise they go to the profile page, you don't want that)
    add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
    function my_login_redirect( $redirect_to, $request, $user ) {
        // Is there a user?
        if ( is_array( $user->roles ) ) {
            // Is it an administrator?
            if ( in_array( 'administrator', $user->roles ) )
                return home_url( '/wp-admin/' );
            else
                return home_url();
                // return get_permalink( 83 );
        }
    }
    Plugin Author glatze

    (@glatze)

    You can try the plugin “Peters’s Login Redirect”: http://wordpress.org/extend/plugins/peters-login-redirect/

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bad redirection at the first login’ is closed to new replies.