How to Reset WordPress User Password

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

There are a few ways to reset a WordPress user’s forgotten password.  As admin, you can log into the WordPress dashboard and go to Users settings.  The user can click the forgot password link in the login screen.  And you can edit the database values via phpMyAdmin (see our other tutorial on how to do this).

But in this tutorial, we show you how to reset an user’s password via a command in the theme’s functions.php file.

1.  At the bottom of the current theme’s functions.php file on the live server, put …

wp_set_password(‘dumbpassword’, 1);

This resets the user with id 1 to a new password of “dumbpassword”.  The user with id 1 is the default admin user that gets created upon initial install of the WordPress site.

2.  Load the login page and type the username of this user and the password supplied in the command (in our example, it is ‘dumbpassword’)

3.  The password for this user has now been reset and page redirects to the login screen again.

4.  At this point, you need to remove the wp_set_password command from the functions.php file.  Otherwise, WordPress will keep resetting the password and keep redirecting back to login page.  You will never get in.

5.  After the wp_set_password command has been removed from the functions.php on the live server, go to login page again and enter username and the newly reset password (in our example it is ‘dumbpassword’).

6.  Once in WordPress dashboard, change the password to a better one.