Function: wp_authenticate_username_password

wp_authenticate_username_password( WP_User | WP_Error | null $user, string $username, string $password )

Authenticate a user, confirming the username and password are valid.


Name Type(s) Default Value Description
$user WP_User | WP_Error | null

WP_User or WP_Error object from a previous callback. Default null.

$username string

Username for authentication.

$password string

Password for authentication.


WP_User | WP_Error

WP_User on success, WP_Error on failure.

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.