It’s easy to read about security in advance, but hard to think about it when your website is already displaying third-party ads and Google is showing a red warning. This guide is for the latter scenario. The order of actions is crucial: half the damage is usually done in the first few hours, when the site owner, in a panic, deletes files and covers their tracks—the very clues that would reveal how the attackers gained access.
Signs that this is indeed a hack
- Unfamiliar text, a link, or a redirect to a third-party website has appeared on the pages.
- The site loads normally for you, but not for visitors accessing it from a phone or via a search engine—this is typical behavior of malicious code that triggers selectively.
- Google or your browser displays a security warning.
- A notification about detected security issues appeared in Search Console.
- The hosting provider sent an email regarding malicious files or spam sent from your account.
- A user you didn't create has appeared in the admin panel.
- Server load has increased sharply without a corresponding increase in traffic.
Step 1. Do not delete anything
Your first instinct might be to delete the suspicious files and forget about it. You shouldn’t do that: along with the traces, you’ll lose the answer to the question of how the attack occurred, and as a result, the same thing will happen again in a week. First, make a complete copy of the site in its current, infected state—including the files and the database—and store it separately, labeling it with the date. This is your evidence for the investigation.
Step 2. Close the website to visitors
If a website distributes malicious code or spam, every hour it remains online increases the damage: visitors get infected, and search engines blacklist the site even more thoroughly. It’s important to return a proper 503 status code—it tells search engines “temporarily unavailable, check back later,” unlike a standard error message.
Step 3. Change all passwords—from a clean computer
If your computer is infected and your password has been stolen from it, changing your password from that same computer won’t help. You need to change it from a different device, and change everything: the website’s admin panel, hosting control panel, FTP and SSH, database, email, and domain registrar account. Use different, long passwords stored in a password manager. Enable two-factor authentication wherever possible.
Check the list of users with administrator privileges separately and remove anyone you don’t recognize. And don’t be quick to trust emails “from hosting support” that you may receive in the coming days: it’s precisely when an incident occurs that people are most susceptible to phishing—read more about this in the article Scammers on messaging apps.
Step 4. Find the entry point
Without this step, treatment becomes a never-ending battle against symptoms. Where to look:
- Access Logs on the hosting server, one day before the first signs appeared: suspicious POST requests to unknown files, and hundreds of requests to the admin panel from a single IP address.
- Files modified in the last few days. Sort by modification date—malicious code almost always leaves recent files in places where nothing should have changed: in the Downloads, Cache, and Themes folders.
- System and extension versions. The most common cause is a well-known plugin with an old vulnerability for which a patch was released six months ago. How this plays out in practice is explained in the article about Critical WordPress Updates.
- The Planner's Tasks. Malicious code often sets up a cron job for itself so it can restore itself after being removed.
- Environment. Sometimes the problem isn't with the website, but with an outdated version of PHP or server settings—an example of this is discussed in the article about php2shell vulnerability.
Step 5. Cleanup or Rollback to a Backup
If there is a recent backup that was created to If your system is infected, the quickest way to fix it is to roll back the system. An important detail: when you roll back, the vulnerability that allowed the infection to occur is also restored, so you must update the system and its extensions immediately after rolling back; otherwise, the infection will recur in a few days.
If there is no backup or all copies are infected, you’ll have to clean it up manually: reinstall the system core and plugins from official sources, verify the remaining files, and check the database for injections in the content and settings. This is a time-consuming and meticulous process—a situation where it makes sense to call in a specialist.
Step 6. Clear the search results
Even after a complete cleanup, the website may still be flagged as dangerous. What to do:
- In Google Search Console, under the "Security Issues" section, request a re-review after the issue has been resolved.
- Check whether the domain has been added to any public blacklists and submit a request for review.
- Check the index to see if there are any pages you didn't create—you need to delete them and return a 404 or 410 status code.
- Check to see if the page titles and descriptions have been altered—you can do this quickly checking meta tags.
- Make sure the certificate is in place and that the website is working properly over HTTPS — SSL verification.
Step 7. Close the door
Once everything is back up and running—do what you should have done earlier: update everything, remove unused plugins and themes (they’re vulnerable even when disabled), set up regular backups stored off-site, limit login attempts, delete unnecessary users, and change the default admin URL. See the article for a complete list How to Protect a Website from Hacking.
When to Call a Specialist
It makes sense to handle it yourself if the website is simple, you have a recent backup, and you know where everything is on the site. You should hand it over to professionals when: all copies are infected; the breach recurs after cleanup; the site contains customers’ personal data or payment information; the site is your primary sales channel, and every day of downtime costs money.
We consider such cases within the scope of website maintenance and updates: Find the entry point, clean it up, restore it to its original state, and then keep track of updates and backups to prevent this from happening again. If the site has been neglected for a long time and you want to understand the scope of the work, describe the situation in cost calculation. For more articles on security, see the section Website Security.


