wp_login

The timeline below displays how wordpress function wp_login has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.4

/**
 * Checks a users login information and logs them in if it checks out. This function is deprecated.
 *
 * Use the global $error to get the reason why the login failed. If the username
 * is blank, no error will be set, so assume blank username on that case.
 *
 * Plugins extending this function should also provide the global $error and set
 * what the error is, so that those checking the global for why there was a
 * failure can utilize it later.
 *
 * @since 1.2.2
 * @deprecated 2.5.0 Use wp_signon()
 * @see wp_signon()
 *
 * @global string $error Error when false is returned
 *
 * @param string $username   User's username
 * @param string $password   User's password
 * @param string $deprecated Not used
 * @return bool True on successful check, false on login failure.
 */
function wp_login($username, $password, $deprecated = '')
{
    _deprecated_function(__FUNCTION__, '2.5.0', 'wp_signon()');
    global $error;
    $user = wp_authenticate($username, $password);
    if (!is_wp_error($user)) {
        return true;
    }
    $error = $user->get_error_message();
    return false;
}

WordPress Version: 4.6

/**
 * Checks a users login information and logs them in if it checks out. This function is deprecated.
 *
 * Use the global $error to get the reason why the login failed. If the username
 * is blank, no error will be set, so assume blank username on that case.
 *
 * Plugins extending this function should also provide the global $error and set
 * what the error is, so that those checking the global for why there was a
 * failure can utilize it later.
 *
 * @since 1.2.2
 * @deprecated 2.5.0 Use wp_signon()
 * @see wp_signon()
 *
 * @global string $error Error when false is returned
 *
 * @param string $username   User's username
 * @param string $password   User's password
 * @param string $deprecated Not used
 * @return bool False on login failure, true on successful check
 */
function wp_login($username, $password, $deprecated = '')
{
    _deprecated_function(__FUNCTION__, '2.5.0', 'wp_signon()');
    global $error;
    $user = wp_authenticate($username, $password);
    if (!is_wp_error($user)) {
        return true;
    }
    $error = $user->get_error_message();
    return false;
}

WordPress Version: 4.4

/**
 * Checks a users login information and logs them in if it checks out. This function is deprecated.
 *
 * Use the global $error to get the reason why the login failed. If the username
 * is blank, no error will be set, so assume blank username on that case.
 *
 * Plugins extending this function should also provide the global $error and set
 * what the error is, so that those checking the global for why there was a
 * failure can utilize it later.
 *
 * @since 1.2.2
 * @deprecated 2.5.0 Use wp_signon()
 * @see wp_signon()
 *
 * @global string $error Error when false is returned
 *
 * @param string $username   User's username
 * @param string $password   User's password
 * @param string $deprecated Not used
 * @return bool False on login failure, true on successful check
 */
function wp_login($username, $password, $deprecated = '')
{
    _deprecated_function(__FUNCTION__, '2.5', 'wp_signon()');
    global $error;
    $user = wp_authenticate($username, $password);
    if (!is_wp_error($user)) {
        return true;
    }
    $error = $user->get_error_message();
    return false;
}

WordPress Version: 4.1

/**
 * Checks a users login information and logs them in if it checks out. This function is deprecated.
 *
 * Use the global $error to get the reason why the login failed. If the username
 * is blank, no error will be set, so assume blank username on that case.
 *
 * Plugins extending this function should also provide the global $error and set
 * what the error is, so that those checking the global for why there was a
 * failure can utilize it later.
 *
 * @since 1.2.2
 * @deprecated Use wp_signon()
 * @global string $error Error when false is returned
 *
 * @param string $username   User's username
 * @param string $password   User's password
 * @param string $deprecated Not used
 * @return bool False on login failure, true on successful check
 */
function wp_login($username, $password, $deprecated = '')
{
    _deprecated_function(__FUNCTION__, '2.5', 'wp_signon()');
    global $error;
    $user = wp_authenticate($username, $password);
    if (!is_wp_error($user)) {
        return true;
    }
    $error = $user->get_error_message();
    return false;
}

WordPress Version: 3.7

/**
 * Checks a users login information and logs them in if it checks out. This function is deprecated.
 *
 * Use the global $error to get the reason why the login failed. If the username
 * is blank, no error will be set, so assume blank username on that case.
 *
 * Plugins extending this function should also provide the global $error and set
 * what the error is, so that those checking the global for why there was a
 * failure can utilize it later.
 *
 * @since 1.2.2
 * @deprecated Use wp_signon()
 * @global string $error Error when false is returned
 *
 * @param string $username User's username
 * @param string $password User's password
 * @param bool $deprecated Not used
 * @return bool False on login failure, true on successful check
 */
function wp_login($username, $password, $deprecated = '')
{
    _deprecated_function(__FUNCTION__, '2.5', 'wp_signon()');
    global $error;
    $user = wp_authenticate($username, $password);
    if (!is_wp_error($user)) {
        return true;
    }
    $error = $user->get_error_message();
    return false;
}