最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I change the default wordpress password hashing system to something custom?

programmeradmin1浏览0评论

Can I change the default wordpress password hashing system by overriding the wp_hash_password function from plugin?

If yes, then what will happen to old stored passwords in DB? How will they be validated for login?

Can I change the default wordpress password hashing system by overriding the wp_hash_password function from plugin?

If yes, then what will happen to old stored passwords in DB? How will they be validated for login?

Share Improve this question edited Mar 11, 2013 at 17:09 mor7ifer 8,6162 gold badges20 silver badges33 bronze badges asked Mar 11, 2013 at 17:04 тнє Sufiтнє Sufi 1,7103 gold badges19 silver badges28 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 12

Just figured it out. So thought to leave the solution here, if someone else need it:

To change the default hashing system, need to overwrite wp_hash_password() function: (can be done in a plugin)

if ( !function_exists('wp_hash_password') ){
    function wp_hash_password($password) {
                //apply your own hashing structure here
            return $password;
    }
}

Now you will need to overwrite wp_check_password() to match your hashing structure: (can be done in a plugin as well)

if ( !function_exists('wp_check_password') ){
    function wp_check_password($password, $hash, $user_id = '') {
            //check for your hash match
            return apply_filters('check_password', $check, $password, $hash, $user_id);
            }
}

Please check wp_check_password

发布评论

评论列表(0)

  1. 暂无评论