Alister West

home is where your code is ...

Wordpress Password Reset

At some stage (v2.5?) Wordpress stopped storing a password hash in the db as a md5. Later versions actively reset this password to be a phpass type password. By default this is a Blowfish encryption.

<?php
    // To reset a password with ssh access run this script
    require( 'wp-load.php' );

    $password = '12345678';
    echo "Hashed $password --> ". wp_hash_password($password) ."\n\n";

    // Or if you know the user_id
    $user_id = 1;
    $user = new WP_User($user_id);

    if( ! $user->ID ){ exit(); }

    echo "    User : " . $user->user_login . "\n";
    echo "Existing : " . $user->user_pass . "\n";

    wp_set_password( $password , $user_id );
    // reload user info
    $user = new WP_User($user_id);

    echo "New pass : " . $user->user_pass ."\n";
?>
By Alister West