Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mohammadmursaleen/3c11ee9fce49ded42e8202cc150b354b to your computer and use it in GitHub Desktop.
Save mohammadmursaleen/3c11ee9fce49ded42e8202cc150b354b to your computer and use it in GitHub Desktop.
Update user password using functions.php file in WordPress
<?php
add_action('init' , 'mm_update_user' , 0);
function mm_update_user(){
$user = get_user_by( 'login', 'developer' ); // Replace 'developer' with username
$user_id = $user->ID;
$password = 'sfsdfsdfsdf123SFSD#';
wp_set_password( $password, $user_id );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment