WordPress.org

Forums

[resolved] Fatal error: Class 'PasswordHash' not found in functions.php (3 posts)

  1. Angela
    Member
    Posted 3 years ago #

    Hi, I need to store a lookup password on my site, so I used the WordPress hash to do it. However, it keeps saying that there the 'Class 'PasswordHash' not found in functions.php'. Here is the snippet:

    $wp_hasher = new PasswordHash(8, TRUE);
    			if(!$wp_hasher->CheckPassword($password, $hash)) {
    				$error = "wrong password";
    			}

    I copied the example straight out of the codex, but I don't know what's missing (perhaps a include/require?)

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try:

    $wp_hasher = new PasswordHash(8, TRUE);
    require_once( ABSPATH . 'wp-includes/class-phpass.php');
    if(!$wp_hasher->CheckPassword($password, $hash)) {
    	$error = "wrong password";
    }
  3. Angela
    Member
    Posted 3 years ago #

    Got it, thanks

Topic Closed

This topic has been closed to new replies.

About this Topic