Warning: This function has been deprecated. Use wp_authenticate() instead.

user_pass_ok() WordPress Function

This function checks if the username and password are both correct. It returns true if they are both correct, and false if either one is incorrect.

user_pass_ok( string $user_login, string $user_pass ) #

Check that the user login name and password is correct.


Description

Top ↑

See also


Top ↑

Parameters

$user_login

(string)(Required)User name.

$user_pass

(string)(Required)User password.


Top ↑

Return

(bool) False if does not authenticate, true if username and password authenticates.


Top ↑

Source

File: wp-includes/deprecated.php

function user_pass_ok($user_login, $user_pass) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'wp_authenticate()' );
	$user = wp_authenticate( $user_login, $user_pass );
	if ( is_wp_error( $user ) )
		return false;

	return true;
}


Top ↑

Changelog

Changelog
VersionDescription
3.5.0Use wp_authenticate()
0.71Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More