# Reset a WordPress admin password
Source: https://docs.webgee.com/en/hosting/wordpress/resetting-your-wordpress-admin-password-a-comprehensive-guide



Three methods, in the order you should try them. Applies to all shared and
reseller hosting.

## 1. The "Lost your password?" link [#1-the-lost-your-password-link]

Try this first. It needs nothing but access to the mailbox on the account.

1. Go to your login page, normally `https://example.com/wp-admin`.
2. Select &#x2A;*Lost your password?**
3. Enter your username or email address, then **Get New Password**.
4. Follow the link in the email you receive.

If no email arrives, the site cannot send mail — which is a separate problem
worth fixing regardless. See
[Why mail from your PHP script fails](/en/email/why-am-i-not-able-to-send-mail-via-my-php-script-or-application).
Use method 2 in the meantime.

## 2. Softaculous in cPanel [#2-softaculous-in-cpanel]

Works when the site cannot send mail, and does not involve editing any code.

1. Log in to cPanel and open **WordPress Manager by Softaculous**.
2. Find the installation and select the pencil (edit) icon.
3. Scroll to **Admin Account** and enter a new password in **Admin Password**.
4. Save, then sign in to the site.

This only lists installations Softaculous knows about. If yours is missing, use
**Scan** to detect it, or use method 3.

## 3. Set the password from functions.php [#3-set-the-password-from-functionsphp]

The last resort. It works when nothing else does, and it briefly puts a
plaintext password in a file inside your web root.

1. Connect over FTP or open cPanel's **File Manager**.

2. Go to `wp-content/themes/` and open your **active** theme's folder.

3. **Download a copy of `functions.php` before changing it.** A syntax error in
   this file takes the whole site down, including the login page you are trying
   to reach.

4. Add this line immediately after the opening `<?php` tag:

   ```php
   wp_set_password( 'new_password', 1 );
   ```

   Replace `new_password` with the password you want. The `1` is the user ID;
   `1` is usually the first administrator, but not always.

5. Save and upload.

6. Load any page on the site once — the code runs on page load, not on save.

7. Sign in with the new password.

8. **Remove the line immediately** and upload the file again.

<Callout type="warn">
  Leaving that line in place resets the password on every single page load, so
  you will be unable to change it from the dashboard afterwards — it will revert
  on the next request. Remove it as soon as you are in.
</Callout>

Two further cautions: edit the theme you are actually using, or nothing happens;
and if the theme updates, your edit is overwritten, which is harmless here but
means the change may vanish before you have used it.

## Afterwards [#afterwards]

* Set a long, unique password, generated rather than invented.
* If you were locked out unexpectedly rather than by forgetting, treat the site
  as possibly compromised — check the user list under **Users** for accounts you
  did not create.

## Related [#related]

* [Enable WP\_DEBUG](/en/hosting/wordpress/how-to-view-enable-and-view-errors-on-a-wordpress-installation-wp-debug)
