When I run wp_hash_password("password") twice the outputs are different. I was under the impression that this is not how hashes are supposed to work. So how should I use wp_hash_password to compare two hashes?


That's just not the way it works. wp_hash_password() will always return a different value for the same password due to SALTing.

You are searching for the wp_check_password() function.

  • Of course, stupid of me, thannks – Joren Oct 11 '13 at 13:52

You can use wp_check_password() , see http://codex.wordpress.org/Function_Reference/wp_check_password

global $current_user;
$user = $current_user;
    if ( wp_check_password( $_POST['current_password'], $user->user_pass, $user->ID) )//check password
             //go ahead and change the password of stuff
  • 1
    Please add a short explanation to your answer. – Pieter Goosen Apr 14 '14 at 16:07

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.