Nothing can be more frustrating than forgetting your passwords. Getting locked out of your WordPress admin dashboard is the last thing you would want to happen. This is somewhat similar to the feeling you get when you reach home after a long day and realize that you have lost your keys. In such a situation, you panic and start looking for solutions. The good news is, WordPress also gives an option to reset your password.
In this blog, we are going to talk about all the possible methods to reset your lost WordPress password.
How to Reset a WordPress Password:
When you forget the password for your WordPress admin, then you have to reset it because WordPress never stores the password of its users in a way that anyone can access it. There are five different methods that you can use to reset your password.
Reset password via cPanel:
You can use this method to change your lost password if you can access the web hosting control panel. For this, you have to:
- Log in to the hosting account of your WordPress website and go to cPanel.
- Find the databases section on this page and click on ‘phpMyAdmin’.
- After logging in to phpMyAdmin, you will see a list of databases on the left-side of your screen.
- Click on the WordPress data of your website.
- Find the ‘ wp_users’ row. On the right side, you will see the ‘browse’ button, click on it.
- This will lead you to a page where you can see a list of all of your users registered on the website.
- Here, you can see the usernames, user email IDs and encrypted passwords.
- From here, you will not be able to see your existing password but you have the option to change it.
- Select the user and click on ‘Edit’.
- In the ‘user_pass’ section, there are two columns: ‘function’ and ‘value’.
- In the ‘Value’ column, there will be a long string. Delete this string and type your new password.
- WordPress passwords are case-sensitive so keep this in mind while choosing a new password.
- You have to choose MD5 from the drop-down menu in the ‘function’ column. This will keep your password encrypted.
- At the very bottom of this page, you will find a ‘Go’ button. To save your changes, click on it.
Your password has been changed. Now you will be able to log in to your WordPress admin using the new password.
Use the Password Reset Link:
This is the fastest method to rest your WordPress password. In this, a password reset URL will be sent to your email ID. For this, you have to follow the steps mentioned below:
- Go to the login page of your WordPress website.
- Next to the username/email address and password box, you will see a link ‘Lost your password’. Click on it.
- This will redirect you to a password reset page.
- Here, you will have to enter either your WordPress username or admin email address.
- Now click on the ‘Get New Password’ button.
- Within a few seconds, you will receive an email containing the password reset link.
- Click on this link and it will lead you to a page where you create a new password.
That’s how easy it is! From now on, you will be able to log in with this password.
Reset Password via functions.php File:
Every WordPress website contains two or three function.php files. One of these files is an important WordPress core file. In any case, you should not modify that file. For this method, you can use the one located in the website’s theme directory. If you are using a child theme, then you have to use the one located in the child theme.
Firstly, you need to find out which WordPress theme you are currently using. You will have to download a copy of the functions.php file of your current theme from your WordPress hosting server using FTP.
- To reset the password, open this functions.php file with a text editor.
- Now insert a code line at the very top: wp_set_password ( ‘abcdef, 1’). Here, ‘abcdef’ is the new password and 1 is the Id number of the WordPress user. You can choose any password, just make sure that you use a new one.
- Save all the changes and upload this edited file to your Website with the help of FTP.
- Now you will be able to log in to the WordPress admin.
After resetting your password, it is important to undo all these changes. For this, download the functions.php file once again and remove the line of code. Now save the changes and upload this updated file to the website through FTP.
Take Help from Another Admin User:
You can use this method if you have more than one admin user for your WordPress website. The other admin user can login and edit your profile. For this, he/she will have to:
- Go to the admin area and then navigate to Users> All users.
- From this page, he/she can make changes to your profile.
- He/she will have to go to the ‘Account Management’ section and click on the ‘Set New Password’ button.
- Once created, the new password will be shared with you.
To protect yourself from any vulnerability in future, it is recommended that you log in with this password and change it again.
Emergency Password Reset PHP Script:
If none of the above solutions work then you can try this one. In this method, you will have to create a PHP file from a pre-written script and add it to the core of your website. For this, you will need the website administrator’s username and email address.
This method should be your last option as this will reset the website admin’s password. The other reason is, it can also create a security risk for the website.
To start resetting your password, follow these steps:
- To get the emergency password reset PHP script, click here.
- Open your text editor and create a new file called ‘emergency.php’. here , you can paste the script that you copied from the above page.
- Edit the information in this script before saving so that it has your website’s admin details. Now you can save this file.
- Log into your web hosting account and then access the control panel. With help of the File manager tool, go to the root of your website.
- Add the new file to the root directory.
- Now, open your browser and go to: https://[yourdomainname].com/emergency.php.
- On this page, you will have to enter the admin’s username and create a new password.
- After choosing a strong password, click on ‘Update Options’.
Now your password has been changed. An email will be sent on the administrator email address containing the new password. Once you are able to log in to your WordPress admin, delete the emergency.php file from the server. This way you are eliminating any possible security risks.
Tips to Safeguard Your Website:
Let’s talk about a few additional tips to safeguard your password and website!
Choose Unique and Strong Passwords:
Using a weak or common password leaves your website vulnerable to attacks. This is why you should always choose one that cannot be easily guessed. Also, you should never create a password using your personal information like name, date of birth etc.
Use a Password Manager:
Although WordPress gives an option to reset your password when you forget it, why go through all those complicated steps. The best option is to use a password manager to keep all your passwords in one place. Some of the best options are 1Password and KeePass.
Use iThemes Security Pro Plugin:
To add an additional layer of security, you can use a WordPress Security Plugin like iThemes Security Pro. This plugin creates and employs complex passwords to protect your website from brute-force attacks. Other features of this plugin are:
- Two-Factor Authentication
- Limits the number of login attempts
- Hides the admin login page and URL of your website
- Tells you whether your password is strong or not
Change Your Password at a Fixed Interval:
To keep your website secured, the best practice is to keep changing your password every six months. If you keep using the same password for a long time, the chances are high that it can get hacked.
Also, never use the same password for multiple accounts.
Add Two-factor Authentication:
When you add two-factor authentication to your website, you will need a secondary code every time you try to log in. This secondary code will be generated via an app. You can use a WordPress plugin like Google Authenticator.
In this digital era when all our lives are online, managing passwords for everything is not an easy task. There can be situations when you just forget some of them. Thankfully, WordPress gives you an option to easily rest your lost password. In the above blog, we have explained different methods to reset your password. Hopefully, this article has helped you to understand the process.
Still have some doubts about this? To get some expert advice you can call us on 1-866-332-O276. Our team of WordPress experts will assist you with all your queries.