# 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.

Canonical: https://red.run.cloud/learn/locked-out-of-wp-admin-after-a-hack · By Timothy Lindblom · Published 2026-11-04 · Updated 2026-11-04

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.

| Fact | Detail | Source |
|---|---|---|
| Official order of steps | Document, scan, check with host, reset access, back up, then find and remove the hack | [WordPress.org FAQ](https://wordpress.org/documentation/article/faq-my-site-was-hacked/), updated 26 July 2026 |
| Ways back in | Lost-password email, phpMyAdmin, WP-CLI, emergency script | [Reset your password](https://wordpress.org/documentation/article/reset-your-password/), updated 27 March 2026 |
| Disable every plugin without admin | Rename the plugins folder, or empty `active_plugins` | [FAQ Troubleshooting](https://wordpress.org/documentation/article/faq-troubleshooting/), updated 3 July 2026 |
| Hidden from the plugin list | Must-use plugins in `wp-content/mu-plugins` | [Developer handbook](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/) |
| Checked | 24 October 2026 | this 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](/learn/website-incident-response-playbook). 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](https://wordpress.org/documentation/article/faq-my-site-was-hacked/): 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.

<figure class="ln-figure">
<svg viewBox="0 0 720 190" role="img" aria-labelledby="ln-fig-title" xmlns="http://www.w3.org/2000/svg" font-family="Geist, sans-serif">
<title id="ln-fig-title">First hour order: record, copy, regain access, cut sessions, look for what stayed</title>
<rect x="0" y="0" width="720" height="190" fill="#FFF1EF"/>
<g fill="#FFFFFF" stroke="#EAD3CF" stroke-width="2">
<rect x="14" y="50" width="124" height="90" rx="14"/>
<rect x="156" y="50" width="124" height="90" rx="14"/>
<rect x="298" y="50" width="124" height="90" rx="14"/>
<rect x="440" y="50" width="124" height="90" rx="14"/>
<rect x="582" y="50" width="124" height="90" rx="14"/>
</g>
<g fill="#C70500" font-size="13" font-weight="600">
<text x="26" y="40">0 to 10 min</text>
<text x="168" y="40">10 to 25 min</text>
<text x="310" y="40">25 to 40 min</text>
<text x="452" y="40">40 to 50 min</text>
<text x="594" y="40">50 to 60 min</text>
</g>
<g fill="#1A0F0F" font-size="16" font-weight="600">
<text x="26" y="82">Record</text>
<text x="168" y="82">Copy</text>
<text x="310" y="82">Get in</text>
<text x="452" y="82">Cut sessions</text>
<text x="594" y="82">Look</text>
</g>
<g fill="#655553" font-size="12">
<text x="26" y="104">what you see,</text>
<text x="26" y="120">when, who knows</text>
<text x="168" y="104">files and</text>
<text x="168" y="120">database, as is</text>
<text x="310" y="104">reset one admin,</text>
<text x="310" y="120">read-only first</text>
<text x="452" y="104">new secret keys,</text>
<text x="452" y="120">all passwords</text>
<text x="594" y="104">admins, mu-plugins,</text>
<text x="594" y="120">core checksums</text>
</g>
<g stroke="#B00500" stroke-width="2" fill="none">
<path d="M138 95 H156"/><path d="M280 95 H298"/><path d="M422 95 H440"/><path d="M564 95 H582"/>
</g>
<text x="14" y="172" fill="#655553" font-size="12">Cleaning and reinstalling come after this hour, once the copy exists.</text>
</svg>
<figcaption>The first hour in order. Each box is a step from the WordPress.org post-hack guidance, arranged by what protects evidence first.</figcaption>
</figure>

### 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](https://developer.wordpress.org/advanced-administration/security/backup/) 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](https://www.cisa.gov/stopransomware/ransomware-guide) 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 have | Documented route | What it leaves behind |
|---|---|---|
| The account email still works | "Lost your password?" on the login page | A reset email in your inbox and a log line |
| Host panel and a database tool | Edit the user row in phpMyAdmin | A changed user row; the doc says use it at your own risk |
| SSH with WP-CLI | `wp user update` for the account ID | A shell history entry |
| Only SFTP or the file manager | The emergency reset script | A script file you must delete afterwards |
| Nothing but support chat | Ask the host to run one of the above | A ticket that dates the request |

All of these come from [Reset your password](https://wordpress.org/documentation/article/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](https://wordpress.org/documentation/article/faq-my-site-was-hacked/) 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](https://wordpress.org/documentation/article/faq-troubleshooting/) 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](https://developer.wordpress.org/cli/commands/user/session/destroy/).

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](/learn/rotate-secrets-after-a-breach-guide).

### 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](/learn/malware-cleanup-cost-one-time-vs-annual-vs-diy) is worth knowing before you hire anyone. The [other incident response guides](/learn/topics/incident-response) 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](https://developer.wordpress.org/cli/commands/user/list/). 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](/learn/find-a-hidden-wordpress-admin) has more places to check. A recent plugin incident that created hidden admins is described in [this Ninja Forms write-up](/learn/ninja-forms-wpc-xss-hidden-admins).

**Must-use plugins.** The [developer handbook](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/) 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](https://developer.wordpress.org/cli/commands/plugin/verify-checksums/), not premium or custom ones. See the [core command](https://developer.wordpress.org/cli/commands/core/verify-checksums/) for `--include-root`, which also reports files in the root that are not WordPress.

<div class="ln-selftest">
<h3>Am I affected? Where you stand right now</h3>
<p>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.</p>
<ol>
<li><span class="ln-state ln-state-detected">Detected</span> <strong>Something visible from outside points to a problem: a search engine warning, a host suspension notice, spam pages or redirects.</strong> Treat the site as compromised. Run the first hour in order and do not restore blindly.</li>
<li><span class="ln-state ln-state-unknown">Unknown</span> <strong>You are locked out and nothing else is visible.</strong> 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.</li>
<li><span class="ln-state ln-state-confirmed">Confirmed by owner evidence</span> <strong>You hold an administrator you did not create, files that fail the checksum check, or a host log of the intrusion.</strong> It is a compromise. Keep the copy, then clean, reinstall and rotate everything.</li>
</ol>
<p>No scan, ours included, moves you from "unknown" to "confirmed".</p>
</div>

## 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](/learn/restored-backup-still-hacked-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](https://developer.wordpress.org/advanced-administration/security/hardening/) 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](/learn/wordpress-security-hardening-after-a-php-incident) go further. Put server-level password protection in front of the admin area as a second layer. The [wp-config reference](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/) 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](/learn/fake-verify-you-are-human-box-on-my-wordpress-site). If a plugin you run was sold or pulled, see [what to do when a plugin was sold then backdoored](/learn/wordpress-plugin-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](/learn/what-an-external-website-scan-cant-prove).

If you are a UK organisation facing an active attack, the NCSC's [small business response guidance](https://www.ncsc.gov.uk/collection/small-business-guidance--response-and-recovery) 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)](https://wordpress.org/documentation/article/faq-my-site-was-hacked/): 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)](https://wordpress.org/documentation/article/reset-your-password/): 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)](https://wordpress.org/documentation/article/faq-troubleshooting/): 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)](https://developer.wordpress.org/advanced-administration/plugins/mu-plugins/): 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)](https://developer.wordpress.org/advanced-administration/security/hardening/): 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)](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/): DISALLOW_FILE_EDIT and the debug constants. Checked 24 October 2026.
7. [WordPress backups (WordPress developer handbook)](https://developer.wordpress.org/advanced-administration/security/backup/): 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)](https://developer.wordpress.org/cli/commands/core/verify-checksums/): Compares core files with WordPress.org checksums without loading WordPress. Checked 24 October 2026.
9. [wp plugin verify-checksums (WP-CLI command reference)](https://developer.wordpress.org/cli/commands/plugin/verify-checksums/): Works for plugins distributed through WordPress.org only. Checked 24 October 2026.
10. [wp user list (WP-CLI command reference)](https://developer.wordpress.org/cli/commands/user/list/): Filter by role and show the registration date. Checked 24 October 2026.
11. [wp user session destroy (WP-CLI command reference)](https://developer.wordpress.org/cli/commands/user/session/destroy/): Ends one or all sessions for a user. Checked 24 October 2026.
12. [phpMyAdmin (WordPress developer handbook)](https://developer.wordpress.org/advanced-administration/upgrade/phpmyadmin/): What phpMyAdmin is for when WordPress itself is not working. Checked 24 October 2026.
13. [#StopRansomware Guide, response checklist (CISA)](https://www.cisa.gov/stopransomware/ransomware-guide): 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)](https://www.ncsc.gov.uk/collection/small-business-guidance--response-and-recovery): First actions after an incident for small organisations. The 24/7 phone line applies to UK organisations. Checked 24 October 2026.
