The first hour after you discover a hacked WordPress site decides whether the cleanup takes a day or a week. Most of the extra work I see is self-inflicted: someone deletes files that held the evidence, restores a backup that was already infected, or changes the admin password from a laptop that is itself compromised. The malware is rarely what makes it hard. The panic is.
Table of Contents
This is the order I work in. It assumes you've confirmed something is wrong (a redirect, a Google warning, a host suspension notice) and you want to contain it without making it worse. If you're still not sure, 15 signs your WordPress site has been hacked covers how to confirm it first.
Would you rather hand it over now? I clean single WordPress sites for a fixed $199, paid online, done within 48 hours of getting access.
Minutes 0 to 10: stop the damage, keep the evidence
Your first job is to stop visitors from being sent somewhere harmful, without destroying anything you'll need later.
- Take the site out of public view. A maintenance page, a host-level "disable site" switch, or a temporary password on the whole site all work. If you use Cloudflare, "Under Attack" mode or a basic firewall rule blocking everyone but your own IP does the same job. Don't leave a site live while it redirects customers to a phishing page.
- Make a full copy before touching anything. Files and database, exactly as they are now. On most hosts that's a manual backup from the control panel, or two commands over SSH:
wp db exportand a zip of the site folder. This copy is your evidence. It tells you when files changed and where the infection sits. - Write down what you saw. The URL, the time, the device, and where the redirect landed. A screenshot helps. You'll want this when you talk to your host.
What not to do yet: delete files, reinstall WordPress over the top, or restore a backup. You don't know yet whether the backup is clean, and deleting things now makes it much harder to find how they got in.
Minutes 10 to 25: lock the doors, in the right order
Credentials come next, and the order matters. If the attacker got in through your hosting account or your email, changing WordPress passwords first achieves nothing, because they can simply reset them again.
- Use a clean device. If you suspect your own computer, do this from your phone or a machine you trust.
- Email first. Change the password on the email account used for hosting and WordPress admin, and turn on two-factor authentication.
- Hosting account next. Control panel, SFTP and SSH passwords, and any API tokens.
- Then WordPress. Reset every administrator password and, more importantly, invalidate existing sessions. Changing the secret keys in
wp-config.phplogs everyone out at once. - Database password last. It means editing
wp-config.phpand the database user together, so do it when the site is already offline.
If you have WP-CLI access, these three commands cover a lot of ground:
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
wp config shuffle-salts
wp core verify-checksumsThe first shows every administrator, and an account you don't recognise, especially one registered recently, is the single most useful clue you'll get all day. The second logs every user out. The third compares WordPress core files with the official versions and lists anything that has been modified.
Minutes 25 to 40: find out how deep it goes
Now work out what kind of infection you have. A quick triage separates a one-line injection from a site with backdoors scattered across several folders.
| What you find | What it usually means | What to do |
|---|---|---|
| One injected script in a theme file or a post | Surface infection, often via a vulnerable plugin | Clean it, patch the plugin, check again in a week |
| Unknown administrator accounts | The attacker had enough access to create persistence | Remove accounts, assume other backdoors exist |
PHP files inside wp-content/uploads | Almost always malicious. Uploads should hold images, not code | Treat as a deep infection |
Modified .htaccess, wp-config.php or files in mu-plugins | Persistent, conditional redirects are likely | Compare against a known good copy, check cron jobs |
| Core files fail the checksum check | Core was tampered with | Reinstall core from a fresh download |
Two more places worth a quick look: wp cron event list for scheduled tasks you didn't create (malware likes to reinstall itself on a timer), and any other sites sharing the same hosting account. On shared hosting, one infected site frequently infects its neighbours, and cleaning only one of them guarantees a repeat.
Minutes 40 to 55: decide whether to clean, restore or rebuild
By now you know enough to choose, and the choice follows a few rules:
- Clean in place when the infection is limited, you can name the entry point, and you can verify the result with a file comparison.
- Restore a backup only when it predates the first sign of compromise and you patch the hole it came through. A restored backup of a still-vulnerable site gets reinfected, often within days.
- Rebuild on fresh files when core is heavily modified, several sites on the account are affected, or you can't identify how the attacker got in. Rebuilding sounds drastic, but it's often faster and safer than hunting for the last backdoor.
If it's a WooCommerce store, check checkout pages and payment settings specifically. Card skimmers hide in checkout scripts and can sit quietly for weeks.
Minutes 55 to 60: tell the right people
Contact your host. Their support team can often provide access logs, run a server-side scan and tell you whether other accounts are involved. Ask them directly: "Can you send me the access logs for the last 14 days and tell me whether other sites on my account were flagged?"
If you run the site for a client, tell them now, in plain language: what you found, that the site is contained, what you're doing next, and when you'll update them. A short honest message early is far better than a perfect one after the client has noticed.
If the site collects personal data or takes payments, there may be legal duties. Under UK GDPR, for example, certain breaches have to be reported to the regulator within 72 hours of you becoming aware of them, and US states have their own notification rules. I'm a developer, not a lawyer, so take advice on that part rather than guessing.
What not to do
- Don't delete the infected files "just to be safe" before you've copied them.
- Don't install three security plugins at once. They conflict, and a scanner can only report known signatures.
- Don't pay a stranger who messages you out of the blue offering to fix it.
- Don't send your hosting password over chat or email. Create a temporary account instead, and delete it when the work is done.
- Don't assume the job is finished when the redirect stops. Redirects are the symptom. The way in is still open.
When to stop and get help
If you've reached minute 40 and you're still not sure what's infected, or the site earns money and every hour offline costs you, hand it over. A good cleanup finds the entry point, removes every backdoor, closes the hole and gives you a written summary of what was found. If you'd like me to look at it, the WordPress malware removal page has the details, and you can send me the URL and what you're seeing. I'll tell you what I think is going on before any work starts.
For a single WordPress site there's a fixed $199 cleanup: you pay online, I email you within 4 hours for access, and the site is cleaned, hardened and written up within 48 hours of getting in. Stores, multisite and same-day emergencies are quoted separately.
Related reading
Get the free WordPress Security Checklist 2026
25-point checklist PDF - malware detection, hardening guide, login security. Used by 500+ WordPress site owners.
- ✓ 25-point security checklist PDF
- ✓ WordPress malware scan guide
- ✓ Hardening checklist for any WordPress site
No spam. Unsubscribe any time.
You're in!
Check your inbox - the checklist PDF is on its way.
Need help with your WordPress site?
I'm a freelance WordPress developer who fixes exactly this kind of problem.
150+ projects. Clients in UK, US, UAE & Ireland. Fast turnaround.

Rajan Gupta
Freelance WordPress DeveloperI'm Rajan Gupta, a freelance WordPress developer based in India with 150+ projects delivered for agencies and businesses in the UK, US, UAE, and Ireland. I specialise in performance optimisation, Core Web Vitals, custom Sage/ACF builds, and WooCommerce development - every project ships with a 90+ PageSpeed baseline.