Your WordPress site is hacked. Maybe you got the “This site may be hacked” label in Google, maybe you’re staring at a defaced homepage, maybe a client emailed you a screenshot of a Viagra ad on your services page. Whatever the trigger, the next hour matters more than the next week.
This is a remediation runbook, not a prevention checklist — if your site is currently clean and you want to stop this from ever happening, our WordPress security checklist covers hardening before an attack. This guide is for the moment after: your wordpress site hacked, and you need a clear order of operations, not a list of a hundred things to maybe try.
A hacked WordPress site is one where an attacker has gained unauthorized access — usually through an outdated plugin, a weak password, or a vulnerable theme — and used it to inject malicious code, spam content, redirects, or backdoor accounts. Recovery means isolating the damage, removing every trace of the attacker’s access, and confirming nothing was left behind before you go back online.

What’s the 6-Step Recovery Runbook for a Hacked WordPress Site?
The runbook has six stages, done in this order and not skipped: isolate, scan, clean, restore, harden, review. Isolating first stops the damage from spreading or getting worse while you investigate. Reviewing last matters because Google won’t lift a security warning until the site behind it is actually clean.
Skipping ahead — say, restoring from backup before you’ve found how the attacker got in — just reintroduces the same hole they used the first time.
- Isolate — take the site offline or into maintenance mode, lock down access.
- Scan — identify every infected file, injected script, and rogue account.
- Clean — remove malicious code and unauthorized users completely.
- Restore — bring back clean content from a verified backup where needed.
- Harden — close the vulnerability that let the attacker in the first time.
- Review — request Google’s manual review to lift any security warning.

How Do You Know If Your WordPress Site Has Been Hacked?
The clearest sign is a Google or browser warning — “This site may be hacked” in search results, or a full-page red warning in Chrome. Short of that, watch for unexplained admin accounts, a sudden traffic drop paired with strange redirects, and content on your site that you didn’t publish.
| Symptom | What It Usually Means |
|---|---|
| “This site may be hacked” in Google results | Google’s Safe Browsing or manual review flagged malware or a security issue |
| Traffic drops but rankings show spam keywords | SEO spam injection — hidden pharma or gambling pages targeting unrelated keywords |
| Unfamiliar admin account in Users | Attacker created a backdoor account for repeat access |
| Visitors get redirected to another domain | Malicious redirect script injected into theme files or .htaccess |
| Browser console shows unknown external scripts | Injected JavaScript, often loading ads or crypto-mining scripts |
| Homepage shows a different image or message | Site defacement, usually a signature left by the attacker |

If you see even one of these, don’t wait for a second sign. Go straight to isolation.
What’s the First Thing You Should Do When You Discover a WordPress Hack?
Isolate the site immediately so the attacker can’t do more damage while you investigate, and so visitors aren’t served malware or redirected to a scam page. This is the single most time-sensitive step in the whole process.
Do this in order, in the first 30–60 minutes:
- Put the site into maintenance mode, or take it fully offline at the host level if maintenance mode isn’t reliable given the compromise.
- Change your WordPress admin password, hosting account password, SFTP/FTP credentials, and database password — all of them, not just the one account you suspect.
- Revoke and regenerate any API keys or application passwords connected to the site.
- Contact your host. Many flag or already suspend compromised accounts, and some (particularly managed WordPress hosts) run their own malware scan as part of support.
- Take a full backup of the compromised site as-is, before you touch anything else — you’ll want it later to identify exactly how the attacker got in.
How Do You Scan a Hacked WordPress Site for Malware?
Run a full malware scan before you delete or restore anything, so you know the true extent of the infection rather than guessing. A partial cleanup that misses one backdoor file just gets you hacked again within days.
Free and paid scanning options, in order of thoroughness:
- Sucuri SiteCheck (free, external) — scans the live site from outside for malware, blacklist status, and known defacement signatures.
- Wordfence or MalCare (WordPress plugins) — scan core, theme, and plugin files against known-good checksums to flag anything modified.
- Manual file diff — compare your live files against a fresh WordPress core download and your theme/plugin vendor’s original files; any difference is suspect.
Pay close attention to wp-config.php, .htaccess, the wp-content/uploads folder (which should never contain PHP files), and any recently modified files — check timestamps against your last known-clean backup.
How Do You Clean a Hacked WordPress Site?
Cleaning means removing every malicious file and unauthorized account the scan found — not just the ones causing visible symptoms. Attackers routinely plant more than one backdoor, so a scan that finds and removes the obvious redirect script but misses a second hidden entry point leaves the door open.
- Delete and reinstall the entire plugin or theme folder where infected files were found — don’t try to hand-edit an infected plugin file, reinstall clean from the source.
- Remove any admin or editor account you don’t recognize or can’t account for.
- Check scheduled tasks (WP-Cron entries and, if you have server access, system cron jobs) for anything unfamiliar — a common backdoor persistence method.
- Search the database for injected content: unfamiliar
<script>tags in post content, unexpected entries in thewp_optionstable, and rogue rows inwp_users. - Re-scan after cleanup, before restoring anything from backup, to confirm zero remaining detections.
How Do You Restore a Hacked WordPress Site From Backup?
Only restore content that’s confirmed clean, and never restore an entire site blindly from a backup taken after the infection started. If your last backup predates the hack, restoring it can bring the malware right back with it.
This is exactly why backup strategy matters before you ever need it — our guide on setting up WordPress backups that actually restore covers the 3-2-1 rule and, critically, testing restores before you need one under pressure.
If you do have a clean pre-infection backup:
- Confirm the backup date is genuinely before the compromise — cross-check against the file timestamps you found during scanning.
- Restore files and database to a staging environment first, not directly to production.
- Re-scan the staging restore before pushing it live.
- Manually re-add any legitimate content published between the backup date and the hack, checking each piece individually.
If no clean backup exists, rebuild from the cleaned live files rather than restoring — slower, but safer than reintroducing a compromised snapshot.
How Do You Harden WordPress After a Hack So It Doesn’t Happen Again?
Hardening means closing the specific hole the attacker used, plus the general weaknesses that make WordPress sites a target — because cleaning up without hardening just buys you time until the next attempt. Most WordPress compromises trace back to an outdated plugin, a weak or reused password, or a theme with a known, unpatched vulnerability.
- Update WordPress core, every theme, and every plugin to their latest stable release.
- Remove any plugin or theme you’re not actively using — inactive code is still a live attack surface.
- Enforce strong, unique passwords and enable two-factor authentication for every admin account.
- Add a web application firewall (Wordfence, Sucuri, or your host’s equivalent) to block known attack patterns going forward.
- Restrict file editing from the WordPress dashboard (
DISALLOW_FILE_EDITinwp-config.php) so a compromised admin login can’t directly edit theme or plugin files.
Our full WordPress security checklist walks through the complete hardening list in more depth, and our WordPress maintenance guide covers the ongoing update and monitoring cadence that prevents this from becoming a repeat problem.
How Do You Get Google to Remove a “This Site May Be Hacked” Warning?
Google removes the warning only after you request a manual review through Search Console, and only once the site is genuinely clean — requesting review while malware is still present just resets the clock and can extend the flagged period.
- Confirm the site is fully clean using a second scan tool, not just the one you cleaned with.
- In Google Search Console, go to Security & Manual Actions → Security Issues.
- Click Request Review and describe, briefly, what was found and what you did to fix it.
- Expect a response within a few days to about a week — Google doesn’t publish an exact timeline.
- Once the warning clears, monitor Search Console for a few weeks; a second flag usually means something was missed.
Should You Clean a Hacked WordPress Site Yourself or Hire a Professional?
DIY cleanup is realistic if you’re comfortable with server file access and database queries and the damage looks contained to one plugin. It gets riskier fast when you can’t find how the attacker got in, when the hack recurs after cleanup, or when you’re not confident you’ve found every backdoor — a missed one means you’re back here within a week.
| Factor | DIY Cleanup | Professional Remediation |
|---|---|---|
| Time to resolve | Hours to days, depending on skill | Typically 24–48 hours |
| Root-cause identification | Easy to miss secondary backdoors | Systematic check across core, theme, plugins, database |
| Cost | Free (your time) | Varies by scope; agencies typically bill $25–$49/hr for remediation work |
| Risk of reinfection | Higher if cleanup is partial | Lower — includes hardening as part of the fix |
If the hack already cost you Google visibility or you want it done right the first time, Web Help Agency’s WordPress site maintenance services include emergency malware removal and hardening — built on 500+ projects for clients in 23 countries, with a 5.0 Clutch rating from 41 reviews. Not sure how bad the damage is? Start with our free website audit — a senior developer reviews your site and sends back a prioritized fix roadmap within 48 hours.
Frequently Asked Questions
A straightforward, single-plugin infection can be cleaned in a few hours by someone comfortable with file and database access. A more thorough compromise — multiple backdoors, defaced content, a Google security flag — typically takes 24–48 hours for a professional cleanup, plus a few days to a week for Google’s review to clear.
Most sites recover their rankings within a few weeks to a couple of months once the malware is fully removed and Google’s manual review clears the warning. The recovery timeline depends more on how long the site stayed flagged than on the hack itself — the faster you clean and request review, the shorter the visibility gap.
Yes, if those sites share the same server account or file system permissions. Attackers who gain file access on shared hosting will often scan for and infect every WordPress installation they can reach from that account, which is why isolating and changing credentials for the whole hosting account matters, not just the one affected site.
Yes. If an attacker had file access to wp-config.php, they had your database credentials in plain text. Change the database user’s password and update it in wp-config.php as part of the credential reset — skipping this leaves a valid, unrevoked path back in even after you’ve cleaned everything else.
It’s a strong first pass but not a guarantee. Security plugins are excellent at flagging known malware signatures and modified core files, but sophisticated or custom backdoors can slip past automated scans. Treat a plugin scan as step one, and follow it with a manual review of recently modified files and unfamiliar admin accounts.
Pricing varies by scope, but agency remediation commonly runs $25–$49/hr, often quoted as a flat project once the damage is scoped — in line with a typical $5,000 minimum for combined cleanup-plus-hardening work. Cost climbs with how many backdoors exist and whether content needs manual restoration.
You Might Also Find Useful
- WordPress security checklist — the hardening steps to put in place so this doesn’t happen again
- WordPress backups — how to set up backups that actually restore when you need them
- WordPress maintenance — the ongoing update and monitoring cadence that catches vulnerabilities before attackers do
- Free website audit — get a senior developer’s assessment of the damage and a prioritized fix roadmap
