WordPress.org

Ready to get started?Download WordPress

Codex

Function Reference/user pass ok


This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use any of these functions instead.

Contents

Description

As of WordPress 3.5 this function has been deprecated in favor of wp_authenticate()


Check that the user login name and password is correct.

Usage

<?php user_pass_ok$user_login$user_pass ?>

Parameters

$user_login
(string) (required) User name.
Default: None
$user_pass
(string) (required) User password.
Default: None

Return Values

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

Examples

<?php
$user_login = 'admin';
$user_pass = 'mypass';
if ( !user_pass_ok( $user_login, $user_pass ) ) {
  echo "Sorry, you are not allowed to do this.";
  exit;
}
?>

Notes

Change Log

  • Deprecated: 3.5.0
  • Since: 0.71

Source File

user_pass_ok() is located in wp-includes/user.php.

Related

See also index of Function Reference and index of Template Tags.