Locked Out of WordPress? How to Reset Your Admin Password (2026)

Padlock and keys resting on a computer keyboard

The easiest way to reset a WordPress password is the “Lost your password?” link on the login page. If the email does not arrive, you can reset it with WP-CLI, by FTP using a one-line code edit, or in phpMyAdmin. Remove any temporary code afterwards.

This guide ranks the methods from safest to most technical, using the official WordPress documentation, and explains what you must clean up afterwards.

Which Method Should You Use?

Your situation Method
You can still log in Change it in Users
You know your username or email and email works Lost password link
Email is broken and you have command line access WP-CLI
You have FTP access only functions.php edit
You have database access phpMyAdmin

Before You Start

Back up your site. If you use the FTP or database methods, you are editing live files, so be careful. If the site shows an error instead of the login page, see our critical error guide first.

Method 1: Change It From the Dashboard

If you can log in, go to Users > All Users, click your username, scroll to New Password and click Generate Password. You can type your own password instead. Click Update User, and the new password is active immediately.

Method 2: The Lost Password Link

On your login page, click “Lost your password?”, enter your username or the email address on file, and WordPress emails you. The documentation says this is normally the easiest way. It needs working email, so check your spam folder.

Method 3: WP-CLI

If you have command line access, WP-CLI can set a password. In your WordPress directory, list users to find the ID, then update that user:

wp user list
wp user update 1 --user_pass=YOUR_NEW_PASSWORD

Replace 1 with the ID of the user, and use a strong password of your own. The command may be saved in your shell history, so clear it if the server is shared.

Method 4: FTP and functions.php

The documentation describes this for the main admin user. Download your active theme’s functions.php, add this line right after the first opening PHP tag, and upload the file:

wp_set_password( 'my_new_password', 1 );

Replace my_new_password with your own password. The number 1 is the user ID, which is typically the main admin. Log in, then remove the line immediately. The documentation warns that it resets your password on every page load until you do.

Method 5: phpMyAdmin

With database access you can edit the user_pass field in the users table of your WordPress database. The documentation says to choose MD5 in the function dropdown when saving, and to use phpMyAdmin at your own risk. If you doubt your ability, choose another method or ask your host.

After You Get Back In

  • Remove any code you added.
  • Use a long, unique password and a password manager.
  • Check Users for accounts you do not recognize.

Verified Facts and Sources

The methods and warnings come from the WordPress.org documentation page on resetting your password, last updated March 27, 2026. We did not test them on a locked site for this article. We left out the older emergency script from that page because it must be deleted afterwards and is easy to forget.

Frequently Asked Questions

What is the easiest way to reset a WordPress password?

The “Lost your password?” link on the login page, according to the WordPress documentation.

What if the reset email never arrives?

Check spam, then use WP-CLI, the FTP method or phpMyAdmin.

Is the FTP method safe?

Only if you remove the line straight after logging in. Left in place it resets the password on every page load.

What is the user ID 1?

Typically the main admin account, as stated in the documentation. Check your own site if you are unsure.

Updated December 2, 2026.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *