I have set of user data from another wordpress site and i want o create users for each of them in a another wordpress web site..,it is works fine with wp_insert_user($user) but problem is the password is hashed agin..,so i can't log with that login information,so how can i create user with hash password or stop creating hashed password


2 Answers 2


You would have to update the password column in the database (see below). But this alone won't work. Password hashes are salted using the SALT keys in your wp-config.php (this must be kept secret). Your new site would need to have identical keys for the password verification to work.

The following function updates a given user's password field (in the database) with the provided (hashed) password:

 * @param int $user_id The user ID
 * @param string $hashed_password The hashed password
 * @return int The number of rows updated (should be 1 or 0 ).
function wpse_update_password_field( $user_id, $hashed_password ){
   global $wpdb;

   return $wpdb->update( 
        array( 'user_pass' => $hashed_password ),
        array( 'ID' => $user_id )

Well for creating hash passwords have a look at this:


IT sounds like it's not hashing it properly. for example:

$password_hashed = '$P$B55D6LjfHDkINU5wF.v2BuuzO0/XPk/';
$plain_password = 'test';

That utilises MD5.

Try reading into wp_hash_password

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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