Localhost WordPress Password Reset
- Go to the folder for the theme your site is currently using: wp-content/themes/[theme-name]
- Open functions.php
- At the top of the file, just inside the opening php tag, add
wp_set_password('password',1);
and save - Log-in as the admin using ‘password’ as your password
- The page will reload. This changes the password to whatever you have defined in your functions.php file
- Remove
wp_set_password('password',1);
and save again, and log-in as normal, using the reset password
Explanation: wp_set_password([string], [uid])
is a function defined in the WordPress core which changes the password to [string]
for the user who’s user ID (uid
) is 1, usually the admin/default user.