I have an existing legacy PHP site of 15000 users with base64 hashed passwords , I would like to import all these users into the new wordpress site with their passwords , What would be the best approach to realize this?


3 Answers 3


You can use wp_insert_user. Since your old database has passwords in base64, you can easily get the original password string using base64_decode.

$new_user_data = array(
        'user_pass' => 'password',//pass your decoded password string
        'user_login' => 'username',//pass your username
        'user_email' => 'email',
        'first_name' => 'firstname',
        'last_name' => 'lastname',
        'role' => 'author'//if you want to specify a different role other than default one
wp_insert_user( $new_user_data );

You need to format your old data in csv or xml or text file and read and pass them accordingly. And don't try to import all 15000 users at once. Do this in several parts. Also sleep() function will be quiet good to give the server some rest.


WordPress uses MD5 for encrypting the passwords. So I don't think direct import of users will work here. You can either write script to import users with new auto generated passwords and fire emails to all.


Use the 'authenticate', 'wp_authenticate_user' filter hooks to validate users with the existing table of users. http://codex.wordpress.org/Plugin_API/Filter_Reference/authenticate

This plugin might help: http://wordpress.org/plugins/external-database-authentication/


WP using md5 for encryption and you have base64 so I don't think that you can directly import the same password. But as we all know that base64 can be decode http://www.php.net/base64_decode so it is clear that we can import your old password as well But there is several WP plugin which will import users from CSV file to WP database and with new password. And system will send new credential notification mail to that user as well. http://wordpress.org/plugins/members-import/ this plugin can help you to do the same. In this plugin where password field data from CSV file is used pass that string to base64_decode() function.

If you are importing same password then no need to send notification mail.

Your Answer

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

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