Home / Blog / Your WordPress Site Has Been Hacked: What to Do, In Order
Security
Your WordPress Site Has Been Hacked: What to Do, In Order
WordPress site hacked? Work in this order: take the site offline, preserve a copy, change every credential, find the entry point, then clean or rebuild. Restoring a backup alone will not fix it, because the way in stays open.
A compromise is unpleasant and it is rarely personal. Automated scripts scan enormous ranges of addresses looking for known weaknesses, and the same weaknesses come up again and again.
Work in this order. Skipping steps is what turns a one-day problem into a recurring one.
1. Confirm it, and take the site offline
Signs: unfamiliar redirects, spam content on pages, unknown administrator accounts, a browser or Search Console warning, sudden slowness, or outbound spam from your domain.
Put the site into maintenance mode or take it offline. This stops visitors being exposed, stops the spam being served, and stops the attacker’s activity being useful.
If it is a store, note the time. You will need to reconcile orders around this point later.
2. Back up the compromised state before you change anything
This sounds pointless and it is not.
You may need to recover recent content from it. You will need it to work out what happened. And if your restore turns out to be older than you thought, this is the only route back to the current data.
Store it separately and clearly labelled so nobody restores it by mistake later.
3. Change every credential
All of them, not just WordPress. Hosting control panel, FTP and SSH, database user, every administrator account, and the email address associated with the site.
Then force every user to log out by regenerating the security keys in your configuration file. Otherwise existing sessions survive the password change.
4. Find the entry point
This is the step people skip and it is the one that determines whether this happens again.
Look at server access logs around when the problem started, particularly POST requests to unusual paths. Check file modification dates and look for anything changed at a time nobody was working. Check the list of users for accounts nobody created.
The usual causes are short: an outdated plugin with a known vulnerability, a reused or weak administrator password, a nulled premium theme or plugin carrying a backdoor, or a compromise elsewhere on shared hosting.
If you cannot establish which, assume the worst and address all four.
5. Clean or rebuild
Rebuilding from known-good sources is more reliable than cleaning, and usually faster than people expect.
Delete WordPress core and reinstall it fresh. Delete and reinstall every plugin and theme from the official source rather than reusing what is on the server. Keep only your uploads directory, your configuration file after inspecting it, and the database.
Then check the parts that are yours. Look in uploads for PHP files, which should never be there. Check the configuration file and .htaccess for injected code. Check the database for injected scripts in post content and options, and for administrator accounts you did not create.
If any custom theme or plugin code is involved, it needs reviewing rather than trusting.
6. Restore only if the backup predates the compromise
This is where a short backup retention hurts. If you only keep seven days and the compromise was three weeks ago, every backup you hold already contains it.
Restoring a clean backup and then reapplying the update that closed the vulnerability is a good outcome. Restoring a backup that contains the same weakness simply resets the clock.
7. Close the door
Update everything: core, plugins, themes and PHP. Delete anything unused rather than deactivating it. Remove nulled software entirely and pay for it or replace it.
Enable two-factor authentication on every administrator. Reduce accounts that have administrator when they need editor. Add DISALLOW_FILE_EDIT to your configuration so the dashboard cannot be used to install code.
8. Deal with the aftermath
If Google flagged the site, request a review in Search Console once it is clean. Removal can take a few days.
Check Search Console for spam pages that were indexed, and make sure they now return the right status rather than continuing to exist.
If your domain was used to send spam, check whether it has been blacklisted, and confirm your email is still being delivered.
If customer data may have been accessed, there are notification obligations in most jurisdictions with real deadlines. That is a question for someone qualified rather than for your developer.
9. Watch it
Reinfection within days is common and it means the entry point was not closed. Scan again after a week. Check for new administrator accounts. Watch for the original symptom returning.
When to hand it over
If the site handles payments or personal data. If you have cleaned it once and it came back. If you are not confident inspecting a database. Or if it is costing you money every hour it is down.
Half-cleaned sites get reinfected, and the second cleanup costs more than doing it properly the first time.
If you want this handled, or want the preventive side sorted before it happens, ask on the contact page.
Frequently asked
Is restoring a backup enough to fix a hacked WordPress site?
No. If you do not find and close the entry point, the same vulnerability is restored along with the site and you will be compromised again within days.
How do WordPress sites usually get hacked?
An outdated plugin with a known vulnerability, a weak or reused administrator password, nulled premium software carrying a backdoor, or a compromise elsewhere on shared hosting. Almost none of it is targeted.
Should I clean the files or reinstall everything?
Reinstalling core, plugins and themes from official sources is more reliable than cleaning and usually faster. Keep only uploads, your configuration file after inspecting it, and the database, then check those for injected code.
How long does it take to remove a Google security warning?
Request a review in Search Console once the site is genuinely clean. Removal typically takes a few days, and requesting a review before it is clean restarts the process.



