Wordpress MD5 Password

烂漫一生 提交于 2019-11-30 15:07:39

The most sensible solution would simply be to use the relevant WordPress function (wp_generate_password) itself.

However, if this isn't an option, you could simply extract the wp_generate_password function (it's in /wp-includes/pluggable.php) and relevant support functions.

Wordpress uses phpass hashing, which is different from MD5.

The easiest way to create the password is ...

  1. to use any rubbish as entry in the MySQL table for user_pass, but a correct email.
  2. Use the "forgot password" function in the login panel to generate a correct password (or activate this link automatically to notify the user).

Don't forget to copy a "wp_capabilities" and a "wp_user_level" from another account.

This function will do what you described to transform the password:

<?
function encrypt_for_wordpress($plain_text_password) {
    return md5("\$P\$B" . $plain_text_password);
}

You'll need to select it from source_db, transform it in PHP, then insert it into new_db.

WordPress used to use MD5 passwords, and still can. Setting the passwords as MD5 hashes should work fine. As each user logs in for the first time, WordPress will rehash their password based on the stronger security it now uses.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!