Quick answer
Work in this order: copy the hacked site as it stands, take it offline or behind a password, change every password and the WordPress security keys, remove accounts you did not create, find the outdated plugin or stolen login that let the attacker in, then restore a clean backup or replace every file with a fresh copy. Request a review in Google Search Console last, once the hole is closed.
Most small business sites are not hacked by a person who chose them. They are hacked by a script that scans thousands of WordPress installs for one outdated plugin, gets in, plants a few files, then moves on. That changes how you should respond. The attacker is not watching you clean up, but the script will come back to the same door if you leave it open.
The steps below assume you have access to your hosting control panel and WordPress admin. If you are locked out of both, start with your host's support team; they can see the files even when you cannot.
Confirm It Is a Hack
A broken site and a hacked site can look alike for a minute. A white screen after an update is usually a plugin conflict. These signs point to a compromise instead:
- Redirects you cannot reproduce while logged in. Injected redirects often target visitors arriving from Google, or visitors on a phone, and skip logged-in administrators. Test from a private window on your phone's mobile data.
- Pages you never wrote. Search Google for
site:yourdomain.com. Pages selling pills, replica goods or casino bonuses, sometimes in Japanese, mean spam pages were added to your site. - A browser or search warning. Chrome's red "Deceptive site ahead" screen, or "This site may be hacked" under your listing in Google.
- Unknown administrators. Check Users in the WordPress admin and filter by Administrator.
- A notice from your host or Google. Hosts suspend accounts that serve malware, and Google Search Console lists hacked content under Security & Manual Actions.
Step 1: Snapshot the Hacked Site
Before you delete anything, take a full copy of the files and the database as they are now. Label it clearly as infected, then store it somewhere off the server. You will not restore from it. You keep it because the injected files carry timestamps, and those timestamps tell you roughly when the attack happened, which tells you which backups are safe.
Skipping this step is a common mistake. People delete the strange files first, then have no way to work out when the infection began.
Step 2: Contain It
Every hour the site stays up, it can infect visitors, send spam from your server, or add more pages to Google's index. Take it out of public view:
- Put the site behind HTTP password protection from your hosting control panel (cPanel calls this Directory Privacy), or ask your host to do it.
- If you cannot do that, a maintenance-mode page is the next best option, provided the attacker has not modified the theme it runs through.
- For a WooCommerce store, disable checkout until you know whether payment pages were altered.
Containment is temporary. Plan for the site to be down for a few hours, not a few minutes.
Step 3: Lock Every Account
Assume every password connected to the site is known to the attacker. Change them from a device you trust, in this order:
- Hosting control panel, then any SFTP or SSH accounts.
- The database password. Change it in the hosting panel, then update
DB_PASSWORDinwp-config.phpto match, or the site will show a database connection error. - Every WordPress administrator, plus editors who can publish.
- The email account that receives WordPress password resets. Whoever controls that inbox can take the site back.
Next, replace the security keys and salts in wp-config.php (the eight lines starting with AUTH_KEY). WordPress.org generates a fresh set at api.wordpress.org/secret-key/1.1/salt/. New keys invalidate every login cookie, so anyone the attacker logged in as is signed out at once.
Then open Users, delete any account you do not recognize, and reassign its content to a real user. Look in Google Search Console under Settings, Users and permissions as well. Attackers who add spam pages sometimes verify themselves as an owner so they can submit sitemaps.
Step 4: Find the Way In
This is the step people skip, and it is the reason sites get hacked twice. On WordPress, the way in is usually one of three things:
- A plugin or theme with a known vulnerability. This is the most common route. Compare every installed version against the public databases; our guide to checking a WordPress plugin for vulnerabilities walks through it, and the WordPress plugin vulnerability tracker lists the serious flaws we have covered each month.
- A stolen or guessed password. Reused passwords from an old breach, or an administrator called "admin" with a weak password.
- A nulled premium plugin or theme. Pirated copies of paid plugins often ship with a backdoor already installed.
Your server's access logs help narrow it down. Look for POST requests to unusual files, particularly anything inside wp-content/uploads/ or a plugin folder, around the time the first injected file appeared. Your host can export these logs if the control panel does not show them.
Step 5: Restore or Clean
There are two routes, and the snapshot from Step 1 decides which one you can take.
Route A: restore a clean backup
If you have a backup from before the earliest injected file, restore it, then immediately update or remove whatever you identified in Step 4 before the site goes back online. You will lose any orders, posts or form entries created since that backup, so export them from the infected copy first if you need them. A good backup schedule is what makes this route possible at all.
Route B: rebuild the files in place
With no clean backup, replace the code rather than hunting through it line by line:
- WordPress core. Download a fresh copy of the same version from WordPress.org, then replace
wp-admin,wp-includesplus the root files, keeping onlywp-config.phpandwp-content. With WP-CLI,wp core verify-checksumslists every core file that differs from the official release. - Plugins and themes. Delete each folder and reinstall from WordPress.org or the vendor. For WordPress.org plugins,
wp plugin verify-checksums --allflags modified files. Remove anything you no longer use. - The places core files do not cover. Check
wp-config.phpand.htaccessfor code you did not add. Openwp-content/mu-plugins/, because must-use plugins load on every request without appearing on the Plugins screen. Searchwp-content/uploads/for any.phpfile; that folder should hold media, not code. - The database. Confirm
siteurlandhomein the options table still point to your domain. Search post content for<scripttags andbase64_decodeyou did not put there.
Once the files are clean, update everything to current versions, then run a malware scan to catch what you missed. Treat the scan as a second opinion on work you have already done.
Step 6: Clear Google's Warning
When the site is clean and back online, open Google Search Console, go to Security Issues, then request a review. Describe what you fixed: the entry point, the files removed, the passwords changed. Google's Search Console help says a security review can take from a few days to a few weeks.
If spam pages were indexed, make sure those URLs now return a 404 or 410 status. The Removals tool in Search Console hides them from results faster while Google recrawls.
When to Call for Help
A single injected redirect on a brochure site with a recent backup is a job many owners can finish in an afternoon. Bring in a professional when:
- The site is reinfected after you cleaned it, which means the backdoor or the entry point is still there.
- Your host has suspended the account and wants proof of a cleanup.
- The site takes payments or stores customer accounts, so altered checkout code is a possibility.
- You found no entry point in Step 4.
Once the site is clean, the work shifts to keeping it that way. Most reinfections come from the same thing as the first infection: a plugin left unpatched. Our WordPress security checklist for small business sites covers the hardening, and a WordPress maintenance plan with security monitoring keeps the updates applied so the next scan finds nothing to exploit.
Hacked WordPress FAQ
How do I know if my WordPress site has been hacked?
The common signs are redirects to spam or scam sites (often only for visitors arriving from Google or on a phone), a "Deceptive site ahead" or "This site may be hacked" warning, pages you never wrote showing up in a site: search on Google, administrator accounts you did not create, a malware notice from your host, or a Security Issues entry in Google Search Console. Any one of these is enough to treat the site as compromised.
Can I just restore a backup to fix a hacked WordPress site?
Only from a backup taken before the infection started, and only after you close the hole the attacker used. Restoring a clean copy while the vulnerable plugin is still on it puts you back where you were the day before the hack, and the same automated tool usually breaks in again within days.
Will deleting the infected plugin remove the hack?
Rarely. Removing the vulnerable plugin closes one door, but attackers normally leave backdoors elsewhere: an extra administrator, a PHP file in the uploads folder, a must-use plugin, or code in wp-config.php. The cleanup has to cover core files, plugins, themes, uploads plus the database.
How long does it take Google to remove a hacked site warning?
After you fix the site, open the Security Issues report in Google Search Console and request a review. Google's Search Console help says a security review can take from a few days to a few weeks. The warning stays until the review passes, so request it only when you are confident the site is clean.
Do I need to tell my customers my site was hacked?
It depends on what the attacker could reach. If the site stored customer accounts, order details or other personal data, many US states have breach-notification laws, and the rules vary. Speak with a lawyer about your situation, and contact your payment processor if checkout pages were altered.
After the Cleanup
Most hacks trace back to one update that did not happen. If you would rather not run that update cycle yourself, our care plans cover updates, offsite backups with tested restores, plus security monitoring, and we will look at what happened on your site before recommending anything.
Book a free 30-minute call to talk it through.
Related reading: WordPress Security Checklist for Small Business Sites • How to Check a WordPress Plugin for Vulnerabilities • WordPress Plugin Vulnerability Tracker