I'm trying to couple an external authentication system as a replacement of the actual WordPress login, but this external authentication system is a little bit weird according to many tutorials and threads I've checked about this subject.

The authentication system I'm using requires to place an iframe in my login page, which hosts its own login fields and verifications, so I shouldn't worry about lost passwords, registering new users (in the authentication system) or wrong username/password. If an user is correct, it redirects to a page I have setup, to which it sends an URL Encoded Encrypted XML via GET with the user data (username, names, email). It doesn't send any password. When receiving this XML in my side, I do the required process to extract the user data in an Object, which contains the mentioned user data.

Now, so far I've managed to make my own login page with the iframe in it, and have the logic to receive and process the XML. What I don't know what to do is to pass data from this object to a login function in the WordPress side of things.

I've seen many tutorials that involve modifying the WordPress built-in login form, that use the user/password scheme to make this work, but I can't do that because there is no other way of authenticating with this system. I have no access to the external database and no API to ease this process.

Is there any function that takes care of the authentication that doesn't require the use of the user/password scheme? Or at least a function that allows me to login without using a password?

1 Answer 1


to connect the user, you need this kind of code :

$args = array(
    // args for searching the user

$wp_user_search = new \WP_User_Query($args);
$items = $wp_user_search->get_results();

$user = array_pop($items);

// connecting the user

    , TRUE // $remember

// redirect to admin root

  • Excellent! I based my code from this snippet and everything is working flawlessly. Commented Jun 29, 2015 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.