wp_login

Advertisement

Deprecated Deprecated

This function has been deprecated. Use wp_signon() instead.

Summery Summery

Checks a users login information and logs them in if it checks out. This function is deprecated.

Syntax Syntax

wp_login( string $username, string $password, string $deprecated = '' )

Description Description

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.

Parameters Parameters

$username

(string) (Required) User's username

$password

(string) (Required) User's password

$deprecated

(string) (Optional) Not used

Default value: ''

Return Return

(bool) True on successful check, false on login failure.

Source Source

File: wp-includes/pluggable-deprecated.php

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;
}

Advertisement

Changelog Changelog

Changelog
Version Description
2.5.0 Use wp_signon()
1.2.2 Introduced.

See also See also

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.