Created
July 17, 2020 14:52
-
-
Save WPAcademic/1f507ffa66d94de2c26a3356d5edbf09 to your computer and use it in GitHub Desktop.
Reset WordPress Password From Username
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('init', function() { | |
$userName = 'admin'; | |
$passwordToSet = 'testing'; | |
$userObj = get_user_by('login', $userName); | |
// $userEmail = 'user@example.com'; | |
// $userObj = get_user_by( 'email', $userEmail ); | |
if($userObj) { | |
$userID = $userObj->ID; | |
wp_set_password($passwordToSet, $userID); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment