Finding out your website has been hacked is stressful. Customers see spam, Google shows a warning, or your host suspends the account. The good news: almost every hacked WordPress site can be recovered without losing content. The bad news: a quick scan-and-delete rarely fixes it for good.
This is the checklist I follow on real cleanups, including multi-layered infections with keyloggers and hidden admin accounts.
Signs your site has been hacked
- Visitors are redirected to spam, adult or scam websites, sometimes only on mobile or only from Google.
- Google results show “This site may be hacked”, or Chrome shows a red warning page.
- You see admin users you did not create.
- A fake CAPTCHA asks visitors to press Windows+R and paste something. This is a “ClickFix” attack and it targets your visitors’ computers.
- Spam pages in Japanese or about pharmaceuticals appear in Google for your domain.
- Analytics suddenly drops to zero, because the malware has replaced or stripped your tracking code.
Step 1: Contain the damage
Do not start deleting files yet. First:
- Take a full backup of the infected site, files and database. It is evidence, and a rollback point if something goes wrong.
- If visitors are being attacked, put the site into maintenance mode or ask your host to block public access temporarily.
- Change your hosting control panel password and enable two-factor login there.
Step 2: Find out how deep it goes
Scanner plugins are a useful start, but they miss things. Check these places by hand:
- Users: list every administrator. Look for unknown accounts and accounts with odd email addresses.
- functions.php in your active theme and child theme: look for long encoded strings,
eval,base64_decodeandgzinflate. - wp-content/mu-plugins: must-use plugins run automatically and do not appear in the normal plugin list, which makes them a favourite hiding place.
- wp-content/uploads: this folder should contain media, not PHP files. Any
.phpfile here is suspicious. - Plugin folders you do not recognise, often named to look like real plugins.
- The database: injected scripts in posts, widgets and the
wp_optionstable, especiallysiteurl,homeand widget settings.
Step 3: Clean properly
- Replace WordPress core files with a fresh copy of the same version.
- Delete and reinstall every plugin and theme from its official source. Do not trust the existing copies.
- Remove unknown admin users and reset the roles of the real ones.
- Remove backdoors and injected code from the files you must keep, such as your child theme and uploads.
- Clean malicious scripts out of the database.
Step 4: Lock every door
If you skip this step, you will be doing it all again next month.
- Change every password: WordPress users, database, SFTP, hosting and email accounts tied to the site.
- Generate new WordPress security keys and salts in
wp-config.php. This logs everyone out, including the attacker. - Update everything, and remove plugins and themes you do not use.
- Turn on two-factor login for all administrators.
- Disable file editing in the dashboard with
DISALLOW_FILE_EDIT. - Put a web application firewall in front of the site, for example Cloudflare or a security plugin firewall.
Step 5: Recover your reputation
- In Google Search Console, open the Security Issues report and request a review once the site is clean.
- Check the site on Sucuri SiteCheck and request removal from any blocklists it shows.
- Check Google Analytics and Tag Manager. Malware often breaks tracking, and you will want accurate data again.
- If customer data may have been exposed, take advice on whether you need to notify anyone.
Why hacks keep coming back
When a client tells me their site was “cleaned” but got reinfected, there is almost always one of three causes: a backdoor was missed, an attacker’s admin account was left in place, or the original hole, usually an outdated plugin or a reused password, was never closed. A proper cleanup finds all three.
If your site is hacked right now, I can clean it for you. Hacked sites go to the front of my queue.
