How to Use the Emergency WordPress Password Reset Script (2026)
Locked out of WordPress and the password reset email never arrives? The emergency WordPress password reset script is a last-resort fix that changes the admin password from a single PHP file. In 2013 it saved us when we couldn’t log in to one of our smaller blogs. The script is still in the official WordPress documentation in 2026, but there are now quicker, safer options to try first. Here’s how to use the emergency password reset script and what to check afterwards.

Quick answer: To use the emergency password reset script, copy the script from WordPress’s Reset Your Password page, save it as emergency.php, upload it to your WordPress root folder, open yoursite.com/emergency.php, enter the admin username and a new password, then log in and delete emergency.php immediately. Try phpMyAdmin, WP-CLI or your host’s panel first if you have access.
Table of Contents
What happened to us
One morning the admin password on a small QOT blog simply stopped working. The “Lost your password?” link said an email was sent, but nothing arrived. Fearing a hack like the one we survived in 2010, we used the emergency script and were back in within minutes. The cause surprised us: the admin account’s email address belonged to a former admin, so he was receiving our reset emails. Lesson learnt: keep admin emails up to date.
How to use the WordPress password reset script
- Copy the script: open the Using the Emergency Password Reset Script section of the official Reset Your Password page and copy the code into a plain text editor.
- Save it as
emergency.php. - Upload it to your WordPress root folder (where
wp-config.phpis) using your host’s File Manager or an FTP client. Don’t put it in the plugins folder. - Open it in your browser:
https://yoursite.com/emergency.php. - Enter the administrator username and a new strong password, then submit. The script updates the password and emails the admin address.
- Log in at
/wp-adminwith the new password. - Delete emergency.php from the server right away. Anyone who finds it could reset your password.
Faster ways to reset a WordPress password
- Your host’s control panel: many hosts, including Hostinger’s hPanel and cPanel’s WordPress Toolkit, let you change the admin password in a couple of clicks.
- phpMyAdmin: edit the
user_passfield in thewp_userstable. We explain each step in how to change a WordPress password with phpMyAdmin. - WP-CLI: if you have SSH access, run
wp user update admin --user_pass="NewStrongPassword". - functions.php: temporarily add
wp_set_password( 'NewPassword', 1 );to your theme’s functions.php, load the site once, then remove the line.
Why the WordPress reset email doesn’t arrive
- Wrong or old email on the admin account, as in our case.
- Server mail blocked or sent to spam: many hosts limit PHP mail. Install an SMTP plugin and send through a proper email service.
- Security plugins or a firewall blocking the login or reset page.
After you get back in
- Check Users for unknown admin accounts and update every admin’s email.
- Turn on two-factor authentication, and use a password manager.
- Make sure you have recent backups; see how to back up websites on your hosting server.
Frequently asked questions
Is the emergency password reset script safe?
It’s safe only while you use it. Delete the file immediately afterwards, because anyone who knows an admin username could use it.
Do I need the admin username to use the script?
Yes. The script asks for the administrator’s username. If you’ve forgotten it, check the wp_users table in phpMyAdmin.
Will resetting the password log out other users?
It changes only that account’s password and logs out that user’s sessions.
Why did my WordPress password stop working?
Usually a typo, caps lock, a changed account email, or a compromised site. If you suspect a hack, change all passwords and scan the site.
Get our free weekly email: new tech guides and tools, no spam.
New and updated tech guides, a free tool worth bookmarking and one useful pick, once a week. No spam, unsubscribe anytime.
One email a week. Unsubscribe anytime. See our privacy policy.







Never face such a issue but thanks for bring it in front of us so we can next time make sure for such a thing. Though it is at own risk it appears that one should take risk to protect one self from such a disaster
Looks straightforward, I usually reset it through database and never had any issue with that.