Skip to content

Instantly share code, notes, and snippets.

@EvanHerman
Created January 31, 2017 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanHerman/24d3aab580f2991c4d6495b02415b1c4 to your computer and use it in GitHub Desktop.
Save EvanHerman/24d3aab580f2991c4d6495b02415b1c4 to your computer and use it in GitHub Desktop.
Update WordPress user password by email address
<?php
/**
* Update an existing user by email address
*
* @author Code Parrots <support@codeparrots.com>
*/
function update_user_password_by_email() {
$user = get_user_by( 'email', 'email@example.com' );
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