
Forgot your WordPress password? 4 easy ways to recover it
It’s common to forget your WordPress login password, especially if you manage multiple sites or user accounts. Fortunately, as the site and hosting owner, you have several safe and effective ways to reset it. In this article, we explain four methods to help you regain access to your admin panel.
1. Recover your password from the WordPress login screen
This is the quickest and easiest method:
- Go to the login screen:
https://yoursite.com/wp-login.php
- Click on Lost your password?
- Enter your email address or username.
- Check your inbox and follow the link to set a new password.
This method depends on your site’s email system working properly. If you don’t receive the email, try one of the following methods.
2. Change the password via phpMyAdmin
If you have hosting access, you can change the password directly in the database:
- Access phpMyAdmin from your hosting control panel (cPanel, Plesk, etc.).
- Select your WordPress database.
- Locate the table ending in
_users
(e.g.,wp_users
). - Click Browse and find your username.
- Click Edit on the corresponding row.
- In the
user_pass
field, selectMD5
from the function column and enter your new password in plain text. - Save the changes.
WordPress used MD5 to encrypt passwords in the past, but now uses more secure hashing methods. This technique still works but should only be used as a temporary fix.
3. Change the password without phpMyAdmin (using another database tool)
If you don’t have access to phpMyAdmin and use a different database tool, you can still change your password:
- Open your preferred database manager.
- Select the WordPress database.
- Find the table ending in
_users
(e.g.,wp_users
). - Locate your user row and edit the
user_pass
field. - Since WordPress expects the password in MD5 format, use an external tool to convert your new password to MD5. For example: MD5 Hash Generator
- Copy the generated MD5 hash and paste it into the
user_pass
field. - Save the changes.
Be sure to use a trusted tool to generate the hash. After regaining access, consider resetting your password from the WordPress admin panel to store it using a stronger encryption method.
4. Create a new admin user with PHP snippet
You can also recover access by creating a temporary administrator account. All you need is access to the site files (via FTP or the hosting file manager):
- Open the functions.php file of your active theme (located in /wp-content/themes/your-theme/).
- Add the following code to the end of the file:
-
<?php function letsGoDevCreateTempAdmin() { $username = 'adminTemp'; $password = 'SecurePassword123'; $email = 'email@yourdomain.com'; if ( ! username_exists( $username ) ) { $userId = wp_create_user( $username, $password, $email ); $user = new WP_User( $userId ); $user->set_role( 'administrator' ); } } add_action( 'init', 'letsGoDevCreateTempAdmin' );
-
- Save the changes and log in using the new account.
- After restoring access, remove this code from
functions.php
.
Recommendations
- Enable two-factor authentication (2FA) to improve security.
- Use a secure password manager to store your credentials safely.
- Make sure WordPress emails are delivered correctly—consider configuring SMTP if needed.
Earn a 35% commission on every sale: Join here.