What to Do in the First Hour After a WordPress Site Is Hacked
An ordered response: contain, preserve evidence, find the entry point, clean, rotate credentials and tell the people who need telling.

In this article
The first sign is usually something odd: a customer reports a redirect to a gambling site, Google shows a warning in search results, the host suspends the account or strange admin users appear. The natural reaction is to restore last week's backup immediately and move on.
That instinct causes two problems. Restoring straight away destroys the evidence of how the attacker got in, and it usually restores the same weakness, so the site is compromised again within days. This guide sets out an ordered first response: contain the damage, preserve evidence, find the entry point, clean or rebuild, rotate every credential and tell the people who need to know.
Contain first: take it offline or put it behind maintenance mode
If the site is redirecting visitors, serving malware or sending spam, stop that harm first. Depending on the hosting, put the site into maintenance mode at the server or CDN level, restrict access to your own IP address or ask the host to suspend public access temporarily. Do this at the server or CDN rather than with a WordPress plugin, because you cannot trust WordPress itself at this point.
If the site processes payments or stores customer accounts, assume data may be affected until you know otherwise. Pause checkout if necessary and contact your payment provider. Write down the time you noticed the problem and what you saw; you will need that timeline later.
Preserve before you clean: snapshot files, database and logs
Before deleting, restoring or updating anything, take a full copy of the current files and database, and download the web server access and error logs. Many hosts keep logs for only a few days, so this step is urgent. Store the copies away from the server, and label them as compromised so nobody restores them by mistake.
This snapshot is your evidence. It lets you, your developer or a security specialist work out how the attack happened and what was touched, without the clock ticking on a live, infected site. It also matters if you later need to tell customers, insurers or authorities what happened.
Finding the entry point in access logs and file timestamps
Most WordPress compromises come through a small number of routes: a vulnerable plugin or theme, a stolen or weak administrator password, a compromised hosting or FTP account, or another infected site on the same server. Check the installed plugins and themes against known vulnerabilities, especially anything outdated, abandoned or installed from an unofficial source.
Then look at the evidence. Search the file copy for recently modified PHP files, unfamiliar files in the uploads folder, which should not normally contain PHP, and code that uses obfuscation such as long base64 strings. Compare the core files with a fresh download of the same WordPress version. In the access logs, look for POST requests to unusual files, requests to plugin paths with known vulnerabilities and logins from unfamiliar locations around the time the problem started. Check the users table for administrators you did not create.
- New or unknown administrator accounts
- PHP files in the uploads directory
- Core files that differ from a clean download
- Outdated or nulled plugins and themes
- Unusual POST requests in the access log before the first symptom
Cleaning, or rebuilding, and how to decide between them
If you know the entry point and the damage is limited, cleaning can work: remove malicious files and code, replace WordPress core, plugins and themes with fresh copies from trusted sources, remove unknown users and close the vulnerability. If the infection is widespread, the entry point is unclear or it has happened before, rebuilding is safer: a fresh install with clean copies of every component, the content imported from a verified-clean database and media checked before it is copied across.
A backup is only a good restore point if it predates the compromise and you have closed the hole. Restoring an older backup without updating the vulnerable plugin brings the weakness straight back. The malware removal guide and the backup strategy guide cover these steps in more detail.
Rotating everything: users, salts, database, hosting, API keys
Assume every secret the site could reach has been seen. Reset the passwords of all WordPress administrators and editors, and ask other users to reset theirs. Change the authentication keys and salts in wp-config.php, which signs out every session. Change the database password, the hosting control panel, SFTP and SSH credentials, and the passwords of any email accounts on the domain.
Rotate API keys for payment gateways, email services, analytics and any other connected system, and check those systems for unexpected activity. Turn on two-factor authentication for administrators and the hosting account. The login security guide and the two-factor authentication guide explain the setup.
Reindexing: Search Console, blacklist removal, reputation
Hacks often leave search damage behind: spam pages indexed under your domain, a security warning in search results or a blocked domain in browsers and email filters. Check the Security issues and Manual actions reports in Google Search Console, and Bing Webmaster Tools. Once the site is clean, request a review through those tools and remove injected spam URLs, returning a 404 or 410 for them.
Check whether your domain or server IP has been added to email blocklists if the site sent spam, and request removal once the cause is fixed. Keep an eye on search results for your brand name over the following weeks.
Disclosure, and the post-mortem that stops the second one
If personal data may have been accessed, you may have legal duties to notify affected people or authorities, and contracts with clients or payment providers may require notice too. In India, the Digital Personal Data Protection Act and CERT-In's reporting directions can both apply, and other countries have their own rules. The requirements and deadlines depend on the data involved and your organisation, so take legal advice quickly rather than guessing.
When the site is stable, write a short post-mortem: what happened, how it was found, the entry point, what was affected and what will change. Common outcomes are automatic updates for plugins, removing unused plugins, a web application firewall, tested off-site backups and regular vulnerability scanning. The security hardening checklist is a good starting list, and the WordPress performance and maintenance service explains how I can help with recovery and ongoing care.
Frequently asked questions
What is the first thing to do when a WordPress site is hacked?
Stop the harm to visitors by putting the site into maintenance mode or restricting access at the server or CDN, then take copies of the files, database and logs before changing anything.
Should I restore from a backup immediately?
Not before preserving evidence and finding the entry point. Restoring first destroys the evidence and usually brings back the same vulnerability. Use a backup from before the compromise, after the weakness is fixed.
How do I find how the attacker got in?
Check plugins and themes for known vulnerabilities, compare core files with a clean download, look for PHP files in uploads and unknown administrators, and review access logs for unusual requests before the first symptom.
Do I have to tell customers about a breach?
Possibly. If personal data may have been accessed, data protection laws, sector rules and contracts can require you to notify people or authorities within set deadlines. Take legal advice as soon as you suspect data was affected.
Topics
- WordPress hacked what to do
- WordPress incident response
- WordPress site compromised steps
- recover hacked WordPress site