Created
January 31, 2017 13:59
-
-
Save EvanHerman/24d3aab580f2991c4d6495b02415b1c4 to your computer and use it in GitHub Desktop.
Update WordPress user password by email address
This file contains hidden or 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
<?php | |
/** | |
* Update an existing user by email address | |
* | |
* @author Code Parrots <[email protected]> | |
*/ | |
function update_user_password_by_email() { | |
$user = get_user_by( 'email', '[email protected]' ); | |
if ( ! $user ) { | |
return; | |
} | |
wp_set_password( 'customPassword123', $user->ID ); | |
} | |
add_action( 'init', 'update_user_password_by_email' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment