1. Red
  2. Learn
  3. Incident response

Locked out of wp-admin after a hack: the first hour

Can't get into wp-admin after a hack? The first-hour order: record, copy, regain access without destroying evidence, cut sessions, then look for hidden admins.

By Timothy Lindblom, FounderPublished 4 November 20269 min readHow we check facts
On this page
  1. Does being locked out mean I was hacked?
  2. What do I do in the first hour, in order?
  3. How do I find hidden admins and plugins that don't show?
  4. What should I not do while locked out?
  5. What changes after I'm back in?
  6. Can a scan help while I am locked out?

If you cannot log in to wp-admin after a hack, do not start deleting files. Write down what you see, ask your host to confirm what they see, and take a copy of the files and database first. Then regain access through the host panel or database, rotate the secret keys, and look for admin users and must-use plugins you did not create.

FactDetailSource
Official order of stepsDocument, scan, check with host, reset access, back up, then find and remove the hackWordPress.org FAQ, updated 26 July 2026
Ways back inLost-password email, phpMyAdmin, WP-CLI, emergency scriptReset your password, updated 27 March 2026
Disable every plugin without adminRename the plugins folder, or empty active_pluginsFAQ Troubleshooting, updated 3 July 2026
Hidden from the plugin listMust-use plugins in wp-content/mu-pluginsDeveloper handbook
Checked24 October 2026this page

This page covers WordPress sites where the login is gone or untrusted. It is the account-and-access chapter of the wider full incident plan for a hacked site. The research kit for this page found people asking for exactly this on public timelines, with slow host support and replies from cleanup sellers. The advice below comes from WordPress.org and the WP-CLI documentation, not from those threads.

Does being locked out mean I was hacked?

No. A lockout is a symptom with several causes, and only some of them are an intrusion. WordPress.org lists the signs it treats as clear indicators: the site blacklisted by a search engine, a host that has disabled the site, a malware flag, antivirus complaints from readers, reports that the site attacks others, new users you did not create, or visible damage.

A password you forgot, a two-factor prompt, a security plugin that blocked your address, or email that never arrives all produce the same login screen. The difference is evidence. Treat the lockout as a reason to look, and keep the word "hacked" for what you can show.

What do I do in the first hour, in order?

Order matters because some early moves destroy the evidence you need later. WordPress.org's own sequence starts with documenting, not cleaning.

First hour order: record, copy, regain access, cut sessions, look for what stayed 0 to 10 min 10 to 25 min 25 to 40 min 40 to 50 min 50 to 60 min Record Copy Get in Cut sessions Look what you see, when, who knows files and database, as is reset one admin, read-only first new secret keys, all passwords admins, mu-plugins, core checksums Cleaning and reinstalling come after this hour, once the copy exists.
The first hour in order. Each box is a step from the WordPress.org post-hack guidance, arranged by what protects evidence first.

Minutes 0 to 10: record and call

Write down what made you think something is wrong, the time with its timezone, and anything you changed recently, such as a new plugin or theme. WordPress.org says this becomes the baseline of your incident report whether you handle it yourself or hire help. Note which host and plan you are on.

Then contact the host. The same guidance says a hack can affect more than your site on shared hosting, and the host can tell you whether the site was suspended for abuse or is simply down. Send the message below.

Our WordPress site at [domain] stopped accepting our admin login at [time, timezone]. Please tell us (1) whether the account or site has been suspended or flagged, (2) the last successful admin login in the access logs, if you can see it, (3) whether you hold a backup from before [date] and how to restore it into a separate location, and (4) how we get a copy of the current files and database today.

Minutes 10 to 25: copy before you touch

WordPress.org says to take a snapshot even if the site is infected, so a bad copy exists to refer to if a cleanup goes wrong. A usable copy needs both parts. The backup guide says files and database are stored separately, back up the database first, and restore files first.

Use the host's backup tool, a file manager download plus a database export, or ask the host to snapshot the account. CISA's response checklist is written for ransomware, but its first steps apply here too: preserve evidence, then reset credentials only once the environment is cleaned.

Minutes 25 to 40: get back in, and read before you change

Choose the lightest method that matches what you still have.

What you still haveDocumented routeWhat it leaves behind
The account email still works"Lost your password?" on the login pageA reset email in your inbox and a log line
Host panel and a database toolEdit the user row in phpMyAdminA changed user row; the doc says use it at your own risk
SSH with WP-CLIwp user update for the account IDA shell history entry
Only SFTP or the file managerThe emergency reset scriptA script file you must delete afterwards
Nothing but support chatAsk the host to run one of the aboveA ticket that dates the request

All of these come from Reset your password. Read the cautions on that page. The emergency script needs the administrator username, changes the password even if the email never arrives, and must be removed when you finish, because someone else could use it. The functions.php route resets the password on every page load until you remove the line.

Before you reset anything, open the users table and look. The FAQ says that if you do not want to deal with password hashes, you can update your own email in the database and use the lost-password link. If the email on your account is not yours, someone else changed it, and that is evidence worth recording.

If the login page loads but you cannot get past a broken plugin, the troubleshooting guide has two documented ways to turn off every plugin. You can rename wp-content/plugins to something like plugins.hold, or set the active_plugins option in the options table to a:0:{}. Renaming keeps plugin settings and leaves every plugin deactivated for you to turn on one by one.

Minutes 40 to 50: cut other people's sessions

A new password does not log out a stolen session. WordPress.org says to update the secret keys in wp-config.php, which forces anyone still logged in off. For one account, wp user session destroy --all ends every session for that user, per the WP-CLI reference.

The same page says to change every access point, including SFTP, wp-admin, the hosting control panel and MySQL, and to cover every user, not only you. WordPress.org also says to scan your own computer, since credentials are often taken from a local machine. For the wider rotation list, see which other keys and passwords to change.

Minutes 50 to 60: look for what stayed

This is only a first look. A full cleanup follows once you hold a copy, and what a cleanup costs and who does it is worth knowing before you hire anyone. The other incident response guides cover the rest.

How do I find hidden admins and plugins that don't show?

Two places hold most of what owners miss.

Administrator accounts. List them with the registration date:

wp user list --role=administrator --fields=ID,user_login,user_registered,user_email

That command and its options are in the WP-CLI reference. Without SSH, open the users table in phpMyAdmin. Look for names you do not recognise and dates near the start of the trouble; a longer walkthrough for finding a hidden admin has more places to check. A recent plugin incident that created hidden admins is described in this Ninja Forms write-up.

Must-use plugins. The developer handbook says mu-plugins are loaded from wp-content/mu-plugins, load before normal plugins, are left out of the default plugin list, and cannot be disabled from wp-admin. To remove one you delete the file. If you find files there that your host or developer did not put there, record the names and dates first. Hosts do ship legitimate files in that folder, so ask before deleting something you cannot identify.

Core and plugin files. wp core verify-checksums compares core files with WordPress.org's checksums and runs without loading WordPress, so plugin code on the site cannot answer for it. wp plugin verify-checksums --all does the same for plugins, with one limit. It only covers plugins from WordPress.org, not premium or custom ones. See the core command for --include-root, which also reports files in the root that are not WordPress.

Am I affected? Where you stand right now

A lockout and an outside scan both fall short of proof. Evidence of a compromise lives in your accounts, files and server logs, which only you or your host can read.

  1. Detected Something visible from outside points to a problem: a search engine warning, a host suspension notice, spam pages or redirects. Treat the site as compromised. Run the first hour in order and do not restore blindly.
  2. Unknown You are locked out and nothing else is visible. This is the common case. A forgotten password, two-factor prompt or plugin lockout looks identical. Get the users table and the host's last-login record before deciding.
  3. Confirmed by owner evidence You hold an administrator you did not create, files that fail the checksum check, or a host log of the intrusion. It is a compromise. Keep the copy, then clean, reinstall and rotate everything.

No scan, ours included, moves you from "unknown" to "confirmed".

What should I not do while locked out?

  • Do not delete the unknown admin or odd files before you have a copy and a note of the name, path and date.
  • Do not restore the newest backup. It may contain the same backdoor. Choose one from before the first sign (how to pick a clean restore point) and keep the current copy aside.
  • Do not reinstall from the dashboard. WordPress.org says those installers often overwrite existing files, while hacks add new ones. It recommends copying /wp-admin and /wp-includes by SFTP instead, in the same version as your site.
  • Do not leave the emergency script, a phpinfo page or a functions.php password line behind.
  • Do not set new passwords once and stop. The guidance says to change them again after you are confident the site is clean.
  • Do not paste credentials into a cleanup seller's chat before you know what they will do and what access they keep.

WordPress.org also warns that .htaccess is one of the most often changed files and can exist in several folders, and that index.php, header.php, footer.php and the theme functions file are common targets. Check those during cleanup.

What changes after I'm back in?

Once you have a copy and a working login, the hardening guide gives the lasting measures. Set DISALLOW_FILE_EDIT so a stolen admin account cannot edit PHP from the dashboard. Keep files writable only by your user account except wp-content. The wider hardening steps after an incident go further. Put server-level password protection in front of the admin area as a second layer. The wp-config reference shows where the constant goes.

If the site loads a fake "verify you are human" box, that is a different cleanup, covered in the fake verification box guide. If a plugin you run was sold or pulled, see what to do when a plugin was sold then backdoored. The October 2026 tracker lists the incidents that are current at our check.

Can a scan help while I am locked out?

An outside view can still show things that do not need your login. The free scan reads the stack your site serves and matches each version to known vulnerabilities. It is a lookup: it can say a version is affected, not whether your setup is exposed. It cannot see inside wp-admin, your users table or your server logs, which is why the self-test above stops at owner evidence. The limits of any outside check are laid out in where outside scans fall short.

If you are a UK organisation facing an active attack, the NCSC's small business response guidance lists a 24 hour phone line for active attacks. Everyone else should start with the host's emergency channel.

Questions people ask

I can't log in to my WordPress admin and I think I've been hacked. What do I do first?

Write down what you see and the time, then ask your host whether they have suspended the site or seen anything on the server. Take a copy of the files and the database before you change anything. Only then regain access, through the lost-password email, the host panel or the database.

My admin password no longer works and the reset email never arrives. Is that a hack?

It can be, but it is not proof. A forgotten password, a two-factor prompt, a security plugin that blocked your address or broken site email look the same from the login page. An attacker who changed your account email also stops the reset message. Check the users table through your host's database tool to see which.

Can I just restore a backup to get back in?

A restore brings back whatever was in the backup, including a backdoor planted earlier. Pick a backup from before the first sign of trouble, keep a copy of the current state, and close the way in as well. If you restore without that, the same account or plugin hole is still there.

How do I find an admin user I didn't create?

List the administrator accounts with their registration dates, either in the Users screen or with WP-CLI or the database tool. Any account you do not recognise, or created near the time trouble started, is a lead. Record it before removing it, because the details help your host or a cleaner.

Why does a plugin not show up in my plugins list but still run?

WordPress loads must-use plugins from the mu-plugins folder. They are left out of the normal list, appear only under a separate Must-Use heading, and cannot be switched off from wp-admin. Look in that folder over SFTP or the host's file manager.

My host is slow to answer. Who else can I ask?

Use your host's emergency or abuse channel and quote what you saw and when. The WordPress.org Hacked forum tag exists for community help. UK organisations can use the NCSC guidance for small businesses. A cleanup freelancer is a paid option, so ask what they will deliver before you give them access.

Sources

  1. FAQ My site was hacked (WordPress.org documentation)Order of steps, indicators of compromise, rotating secret keys, reinstalling wp-admin and wp-includes, the .htaccess warning. Page last updated 26 July 2026. Checked 24 October 2026.
  2. Reset your password (WordPress.org documentation)Documented ways back in: lost-password email, phpMyAdmin, WP-CLI, the emergency script and its cautions. Page last updated 27 March 2026. Checked 24 October 2026.
  3. FAQ Troubleshooting: deactivate all plugins without admin access (WordPress.org)Rename the plugins folder, or set active_plugins in the options table. Page last updated 3 July 2026. Checked 24 October 2026.
  4. Must-Use Plugins (WordPress developer handbook)Where mu-plugins live, why they are absent from the normal list, and that they cannot be disabled from wp-admin. Checked 24 October 2026.
  5. Hardening WordPress (WordPress developer handbook)File permissions, DISALLOW_FILE_EDIT, a second layer of protection on the admin area. Checked 24 October 2026.
  6. Editing wp-config.php (WordPress developer handbook)DISALLOW_FILE_EDIT and the debug constants. Checked 24 October 2026.
  7. WordPress backups (WordPress developer handbook)A restorable copy needs both files and database; back up the database first, restore files first. Checked 24 October 2026.
  8. wp core verify-checksums (WP-CLI command reference)Compares core files with WordPress.org checksums without loading WordPress. Checked 24 October 2026.
  9. wp plugin verify-checksums (WP-CLI command reference)Works for plugins distributed through WordPress.org only. Checked 24 October 2026.
  10. wp user list (WP-CLI command reference)Filter by role and show the registration date. Checked 24 October 2026.
  11. wp user session destroy (WP-CLI command reference)Ends one or all sessions for a user. Checked 24 October 2026.
  12. phpMyAdmin (WordPress developer handbook)What phpMyAdmin is for when WordPress itself is not working. Checked 24 October 2026.
  13. #StopRansomware Guide, response checklist (CISA)Isolate, preserve evidence, reset credentials once the environment is cleaned. Written for ransomware; the order applies to any intrusion. Checked 24 October 2026.
  14. Small business guidance: response and recovery (UK NCSC)First actions after an incident for small organisations. The 24/7 phone line applies to UK organisations. Checked 24 October 2026.

Facts on this page are dated and point at the primary source next to them. If a vendor status changes after the date shown, the vendor's page wins; tell us at support@run.cloud and we will update it.