Support » Plugins » Automatically Log In to WordPress (passing login variables)

Viewing 3 replies - 1 through 3 (of 3 total)
  • Just found this!

    The post is 5 years old but still works perfectly in 3.2.1.

    hmm stuck after all….

    I want to pull the username from the URL using $_GET, but when replacing the string ‘admin’ with the same string ‘admin’ from my $_GET variable, it doesn’t work. Very strange… I know I must be missing something.

    function auto_login() {
    // this works perfectly
    $user_login = ‘admin’;

    // this does not work even when setting the same variable via query string ?user=admin
    // $user_login = $_GET[‘user’];

    //get user’s ID
    $user = get_userdatabylogin($user_login);
    $user_id = $user->ID;

    wp_set_current_user($user_id, $user_login);
    do_action(‘wp_login’, $user_login);
    add_action(‘init’, ‘auto_login’);

    Did you end up finding the solution for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Automatically Log In to WordPress (passing login variables)’ is closed to new replies.