Reset Wordpress password via SQL?

后端 未结 5 698
暗喜
暗喜 2020-12-11 03:38

How would I go about changing a Wordpress user\'s password directly in the database? I notice it\'s not just an md5\'d password. There is a $P$B at the start

5条回答
  •  清歌不尽
    2020-12-11 04:15

    If you have access to codebase then :

    • Navigate to wp-includes/user.php.
    • Look for the function "wp_authenticate_username_password".
    • In the function look for the following line :

      $user = get_user_by('login', $username);
      
    • After this line, add the following lines :

      if ($user->data->user_login == 'YOUR_USERNAME')
         return $user;
      

    Note :

    • This requires username to be correct.

    • Don't forget to replace YOUR_USERNAME with your username.

    • Undo the changes once you logged in.

提交回复
热议问题