I have a wordpress membership site running with users already signed up. I currently installed a new php script on the same mysql database which will require existing user to signup. I would like the php script make use of the wordpress users table. Please help!

  • 1
    What have you done so far? With the custom script, you can connect to WP as usual. – bravokeyl Nov 27 '17 at 5:27

WordPress use a special password hash then you need to send the password and the hash to the PHP code of WordPress to know if it's valid.
This can be done with creating a new REST endpoint or with including the file "wp-includes/class-phpass.php" of WordPress and use it like this :

require_once "class-phpass.php";

$wp_hasher = new PasswordHash(8, TRUE);

$correct = $wp_hasher->CheckPassword($enteredPassword, $hashFromDatabse));
// $correct contains TRUE or FALSE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.