How to check username/password without signing in the user

There is a function in the user.php of the core files called wp_authenticate_username_password that seems like what you’re looking for.

If you want to avoid throwing in the $user object (you probably only have the username + password), then just throw null as 1st function argument in:

$check = wp_authenticate_username_password( NULL, 'some_username', '#thepassw0rd' );

You can then simply check the result with is_wp_error( $check ).

Leave a Comment