wp_login()WP 1.2.2

Устарела с версии 2.5.0. Больше не поддерживается и может быть удалена. Используйте wp_signon().

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.

Хуков нет.

Возвращает

true|false. True on successful check, false on login failure.

Использование

wp_login( $username, $password, $deprecated );
$username(строка) (обязательный)
User's username
$password(строка) (обязательный)
User's password
$deprecated(строка)
Not used
По умолчанию: ''

Заметки

  • Смотрите: wp_signon()
  • Global. Строка. $error Error when false is returned

Список изменений

С версии 1.2.2 Введена.
Устарела с 2.5.0 Use wp_signon()

Код wp_login() WP 6.5.2

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