WordPress.org

Ready to get started?Download WordPress

Forums

wp_signon redirect (2 posts)

  1. niccol
    Member
    Posted 3 years ago #

    I am using wp_signon to create a login form. My problem is that on successful login the user is directed to wp-admin which I do not want.

    I thought that wp_signon returned an object but did not divert to wp_admin. This is the way it works on failure but on success the user is taken to wp-admin.

    $creds['user_login'] = $_POST['username'];
        $creds['user_password'] = $_POST['userpassword'];
        $creds['remember'] = true;
    
        $user = wp_signon( $creds, false );
    
        if ( is_wp_error($user) )
          echo $user->get_error_message();

    The code is pretty much taken from the codex ( yes I know I could use the post variables direclty) So really do not understand why :-)

    Thanks in advance....

  2. niccol
    Member
    Posted 3 years ago #

    My error.

    There was a plugin that had added an action to 'wp-login' with a redirect in it. With nothing acting on 'wp-login' this all works as expected.

    Nick

Topic Closed

This topic has been closed to new replies.

About this Topic