Order of operations matters more here than any tool you could buy. When a site is hacked, the first hour decides whether this costs you one ugly evening or three weekends. And everyone’s instinct (find the scary file, delete it, refresh the homepage, exhale) is the one that reliably buys the three weekends.
Here’s the sequence, then the reasoning behind it.
- Confirm it’s a compromise, not a broken plugin.
- Take the site offline properly.
- Snapshot everything before you change a byte.
- Rotate credentials from the outside in, starting with email.
- Find the entry point.
- Clean or restore, then patch the hole.
- Request a security review in Search Console, then check your email reputation.
None of it is hard. It’s slow, and it has to happen in order. Rather hand it off? Tell me what you’re seeing.
Is it hacked, or is it just broken?
Broken sites fail the same way for everybody. Hacked sites behave differently depending on who’s looking. Three checks.
- Open the site in a private window, then on your phone over cell data. Injected code often checks whether you’re logged in and behaves when an admin is watching. Looking fine signed in proves nothing.
- Google site:yourdomain.com and read the titles. Pages you never wrote, titles in a language you don’t speak, pharmacy words. That’s injected spam, and it surfaces in search long before anywhere you’d click.
- Open Search Console, Security Issues. If Google flagged you it says so there, with the category and sample URLs. Free head start.
Identical white screen for everybody, thirty seconds after you clicked Update? Almost certainly a plugin conflict. Roll it back before you treat it as a break-in.
Why take the site offline before you touch anything?
Because a live compromised site works against you two ways. It serves whatever the attacker wants to real visitors and burns your standing with Google while you work, and if they still have a foothold it rewrites files behind you.
Do it at the host level, not with a maintenance-mode plugin, because a plugin runs inside the install you no longer trust. Most hosts let you disable the site or point the domain at a holding page. Don’t unpublish pages or noindex everything, because a mass deindex outlives the hack. Search engines handle a short outage fine if that holding page returns a 503, not a 200 (503 says “back soon”, 200 says “this is the page now”). Days are fine. Weeks are a different conversation.
Then, before you fix anything: copy the files and database, infected and all, off the server. Label it so nobody restores it by accident. Often the fastest recovery means pulling page content out of that dirty copy.
Rotate credentials in this order, email first
Rotate from the outside in, because whoever controls the reset path controls everything downstream. Changing your admin password first is theater if they’re in your inbox waiting for the reset link.
- The email account tied to your host, registrar and admin user. New password, 2FA on, and check the forwarding rules for anything you didn’t set.
- Your hosting control panel. New password, 2FA on, and review who else has access. Old developers count.
- SFTP and SSH. Rotate passwords, delete unrecognized keys and unused accounts.
- The database user. Change it in the host panel and update wp-config.php to match, back to back, or you’ll take your own site down. Memorable way to learn it.
- Every WordPress user with Administrator or Editor access. Not just yours. Delete accounts you don’t recognize, demote anyone who doesn’t need admin.
- The keys and salts in wp-config.php. Replace those eight lines with fresh values from the official WordPress generator. That invalidates every login cookie, including a stolen one.
And the step nearly everybody skips: revoke application passwords. They live on each user’s profile page and let apps talk to your site without your real login. Here’s the catch that ruins people’s week. They survive a password change on purpose, so automations don’t break, and they bypass two-factor, because scripts can’t tap a phone. Your reset changed nothing for an attacker holding one. Revoke them by hand on every account, plus any plugin API keys.
How do you find the entry point?
Find it before you clean, or you’re not fixing the hack, you’re rescheduling it. Start with a timeline. Sort files by date modified over SFTP, or run find . -name “*.php” -mtime -30 with shell access. A cluster of PHP files stamped with the same minute is worth a look, though a routine plugin update looks the same, so check that timestamp against anything you installed. Attackers can fake modification dates too (one touch command), so a clean timeline doesn’t clear you either.
When a timestamp looks wrong, take it to your host’s access logs and read the POST requests around it. Then check your users table for accounts registered near that time, or one whose role quietly changed.
Since it comes up constantly now: yes, you can paste a suspicious file into an AI assistant and get a decent read on what that code does. We do it too. What it can’t tell you is what else is on the server, whether the door is still open, or which plugin shipped the hole. That’s legwork across logs, users, cron and the database. AI narrows the search. It doesn’t finish the job.
How it got in is usually boring. An outdated plugin with a documented vulnerability. A nulled premium theme downloaded to skip a license fee (pirated software often ships the backdoor built in, that’s the business model). A reused password.
Where does the payload actually hide?
| Where to look | What you’re looking for |
|---|---|
| wp-content/uploads/ | Any .php file you can’t account for. Uploads holds images and PDFs, not code. The exception: empty index.php files WordPress drops in to block directory listing. Anything with actual code is not an exception. |
| wp-content/mu-plugins/ | Anything unfamiliar. Must-use plugins load automatically, can’t be deactivated from the dashboard, and only appear under the Must-Use tab, which most people have never clicked. |
| wp-config.php | Injected code at the very top or bottom. Usually long base64 or hex strings. |
| .htaccess (root and subfolders) | Redirect rules you didn’t write, especially ones firing only for mobile or search traffic. |
| Theme functions.php, footer.php | Code appended below the last function you recognize, past the blank lines. |
| The database | A changed siteurl in wp_options, script in an autoloaded option, links in wp_posts you never added. |
| Scheduled events (WP-Cron) | Tasks you don’t recognize. This is why “I cleaned it and it came back overnight” is so common. |
Don’t perform surgery on core, plugins or themes. Delete and reinstall clean copies from WordPress.org or the vendor. Hand inspection is for files nobody else has a clean copy of: custom theme, custom plugin, uploads, wp-config.php, .htaccess, the database.
Will restoring last week’s backup fix it?
Often no, because the backdoor is usually older than the damage you noticed. Attackers get in, sit quiet, monetize later, so by the time your homepage visibly breaks that access may be months old. Restore “the version from before it broke” and you’ve restored a compromised site.
Date it with the timeline you built: the rogue admin’s registration date, the oldest modified file, the first-detected date in Search Console. Restore from before the earliest of those, not from before you noticed. If your host’s backup window doesn’t reach that far, the backup isn’t your answer.
Two things people learn expensively. A full restore rolls back your real data too, so a blind rollback can erase a month of orders and form entries. And it reinstalls the vulnerable plugin. Restore, patch, rotate, in that order.
How do you get un-flagged by Google and Chrome?
Clean completely, then ask. In Search Console, open Security Issues and Request a Review, describing the problem and what you did. Requesting one while a backdoor is still in place burns days for nothing.
Those red interstitials (“Deceptive site ahead”, “The site ahead contains malware”) come from Google Safe Browsing, which Chrome, Firefox and Safari all consult, so clearing it with Google clears it nearly everywhere. And since people spiral about this: the repeat offender policy that blocks another review for 30 days does not apply to sites that keep getting hacked. It targets sites publishing harmful content on purpose.
Then the fallout people forget. If your server got used to send spam, your business email is in trouble too, because receiving servers judge the domain, not the website. Confirm SPF, DKIM and DMARC are correct, not merely present, and check the major blocklists for your domain and your host’s IP (most publish a delisting form). Don’t answer deliverability trouble with a newsletter blast.
What does it cost to clean a hacked WordPress site?
Three paths. I’d rather give the shape of each than invent numbers for other people’s businesses.
Your host’s malware removal. Most decent hosts sell one, and they see the server side, including logs going back further than your control panel shows. Check their current pricing page, not a number in anybody’s blog post, including this one. The risk is scope: removal is priced to clear the payload, and finding how they got in is a separate, slower job. Ask whether entry-point analysis is included, because if it isn’t, you bought a pause.
Somebody working it by hand. A human reads the logs, dates the intrusion, patches the actual hole, then watches the site a week. You’re paying for the entry point, the part scanners are worst at. Worth it any time the site is part of how you get found or get paid. If that’s yours, send me what you’re seeing.
Rebuild it. Sometimes cheaper: when the install is years stale, when nulled plugins are involved, when no backup predates the compromise. You’d be paying to rescue something you were replacing anyway. Our Launch package is $2,400 flat (brand kit, custom design, full build, ten pages populated, on-page SEO and training) and moving a site runs $700 to $1,800. See how we build small business sites, what’s included, and what a small business website actually costs.
One line that never belongs in the cost-cutting column: updates, off-server backups, 2FA. Not because I sell maintenance (I do), but because all three paths above open with the same quiet sentence. “I know I was behind on updates.” Prevention is the only cheap part of this.
Five things that would have prevented this, ranked by effort
- Two-factor on the WordPress admin and the host account. Fifteen minutes, free, and it shuts down credential reuse, one of the handful of ways small sites get taken.
- Delete what you don’t use. A deactivated plugin still has files on the server, and those files can still be reached directly. Deactivated is not removed.
- Actually apply updates. Core on automatic, plugins weekly, and look at the site afterward. The looking is the part people drop.
- Off-server backups with real history. Seven days of retention is useless against a compromise that began five weeks ago.
- Least privilege. Your bookkeeper doesn’t need Administrator, and contractors get accounts you revoke the day they finish.
Look, if you’re reading this at 11pm with tomorrow booked solid: your site wasn’t running a plugin from 2022 because you don’t care. Checking was never anyone’s job. And a weekly rhythm you keep personally, forever, on top of running a business, isn’t a plan. It’s a hope. That gap is the whole job description of a maintenance plan. Ours is $300 a month for Care, $650 for Grow, month to month: updates, off-server backups with real history, a human looking afterward.
Questions people ask at 1am
Can I clean it myself?
If it’s a brochure site with no store, no customer data and no revenue riding on it, and you already live in SFTP, a straightforward infection is inside reach. That stops the moment money moves through the site, customer records sit in the database, or it comes back once. And notice what trips up capable people. Never the cleanup. The entry point: unpaid forensics, at night, on a site you can’t leave offline a week. At that line, hand it over.
My host says it’s clean. Is it?
Verify before the maintenance page comes down, because “clean” often means “we removed what our scanner matched.” Rogue admins gone, no unexplained PHP in uploads, scheduled events normal, a fresh incognito visit over cell data behaving. Then watch it a week. A fine week to hand off.
Will this hurt my Google rankings?
While the warning is up it costs you traffic: people see a red screen instead of your homepage. Google lifts the label once a review passes, so cleanup is the slow part, not the review. Don’t file early to save time. A failed review costs more than an extra hour of checking. And I’d be making things up if I gave you a recovery timeline.
So, next step. Mid-incident? Tell me what you’re seeing, ugly details included: screenshots, strange URLs, whatever your host emailed you. And if none of this is your world, that’s fine, it was never supposed to be. If the dust has settled and you’re staring at an install nobody has touched since 2021, run it through the calculator and we’ll tell you straight: rescue or rebuild. Beats refreshing your homepage at midnight, hoping.