Cleaning up a hacked WordPress site takes more than deleting the bad files. A proper cleanup starts by containing the damage and keeping a copy of the infected site, then finds how the attacker got in and removes every backdoor. After that come new passwords, a patch for the hole and getting the site off any blocklists. Anyone who can fix a hacked WordPress site properly should be able to explain each of those steps to you before they start.
This post is about the cleanup itself, and our post on what gets WordPress sites hacked explains how they get broken into in the first place.
Signs your WordPress site has been hacked
Most infections are built to stay hidden from the owner, so the signs are often indirect.
Google Search Console might send a security warning, your search listing might show "This site may be hacked," or Chrome might show visitors a red warning page. A Google search for site:yourdomain.com can turn up pages you never wrote, often in Japanese or selling pills and knock-off goods.
Visitors arriving from Google or on phones may get redirected somewhere else while you, logged in on your desktop, see a normal site. You might find admin users you don't recognize, or your host might warn about outgoing spam or suspend the account, and your business email might start landing in spam folders.
Any one of these is reason enough to get the site checked.
Who can fix a hacked WordPress site
Cleanup gets sold under several names, like malware removal or website technical remediation, and the people offering it don't all do the same job.
Your host. Some hosts scan and restore, while others suspend the account and leave the cleanup to you. A restore is only one part of a cleanup.
A malware removal service. These usually clean files and request blocklist reviews, often on a subscription. Quality varies, and some don't look for the entry point.
A WordPress developer who does security work. Someone who knows how WordPress, its database and your plugins fit together can find what a scanner misses and fix the underlying problem.
When you need emergency website repair, it's tempting to hire whoever answers first, but ask four things before they start anyway. Find out whether they'll work out how the attacker got in, and whether they'll check the database and user accounts as well as the files. Ask too who handles the blocklist reviews and what happens if the infection comes back. Someone who can't answer clearly is probably planning to delete the obvious files and stop there.
Containing the damage and copying the infected site
First, stop the site harming visitors. If it's redirecting people or serving malware, take it offline or put up a maintenance page. Change the hosting control panel and SFTP passwords straight away, since those live outside WordPress. Leave the WordPress passwords until the backdoors are gone, because malware on the login page can record a new password as easily as the old one.
Then, before deleting anything, take a full backup of the infected site, including the files, the database and the server's access logs. Copying malware on purpose feels backwards, but that copy is your evidence for finding the entry point, and it lets you recover anything the cleanup removes by mistake. Many hosts keep logs for only a few days or weeks, so save them early.
Finding the entry point
Quick cleanups often skip this step, and it's the main reason sites get reinfected. If the hole's still open, the same automated scanner will find it again.
The usual suspects are a plugin or theme with a known vulnerability, a stolen or weak admin password, a pirated premium plugin, or leaked SFTP credentials. To work out which, compare the dates on the earliest modified files with the access logs from the same window, check each plugin's version against public vulnerability databases, and look at which accounts logged in and from where.
Removing malware, backdoors and rogue accounts
Many cleanups stop at deleting whatever files a scanner flags, and a thorough one goes a lot further than that.
It replaces WordPress core with fresh files from WordPress.org and reinstalls every plugin and theme from a clean source, rather than hunting for injected lines in the old copies. The uploads folder should only hold media, so any PHP files in there are suspect, and the must-use plugins folder needs checking too, since anything in it loads automatically and can't be switched off from the dashboard.
Someone should read wp-config.php and .htaccess line by line, because both are favorite places for redirects and hidden includes. The database needs searching as well, for injected scripts in posts, widgets and settings and for spam pages hidden among your real ones, and so do the scheduled tasks, in WordPress and on the server, in case one of them reinstalls the malware.
Every user account gets a review too, which means removing admins you don't recognize, looking for application passwords added to real accounts and checking the users table directly, because some malware hides its admin account from the Users screen.
A scanner is useful for confirming the result, but new or customized malware often doesn't match anything in its database, so it can't be the whole method.
Rotating credentials, patching and clearing blocklists
Once the site's clean, change everything an attacker could have read, which means every admin password, the database password, the security keys in wp-config.php (changing those signs everyone out) and any API keys stored in plugin settings, such as payment or email keys. Then fix the cause. Update or replace the plugin that let them in, delete plugins and themes you don't use, swap any pirated plugin for a licensed copy, and move to a supported PHP version. After that, keeping the site patched is what ongoing maintenance is for.
Next, deal with the warnings. If Google flagged the site, request a review from the Security Issues report in Search Console. Reviews can take anywhere from a day to a few weeks, depending on the type of problem. Check other blocklists too, including the ones email providers use if the server was sending spam. Spam pages Google indexed will drop out as they start returning "not found", and the Removals tool in Search Console can hide the worst of them sooner.
Then keep an eye on file changes, new users, outgoing mail and Search Console for a few weeks, because anything the cleanup missed tends to show up in that time.
Why restoring an old backup often isn't enough
Restoring a backup from before the hack is useful, and often the fastest part of a cleanup, but on its own it leaves problems in place.
The hole comes back with it. The backup contains the same vulnerable plugin, and the scanners will find it again.
The infection may be older than you think. Backdoors often sit unused for weeks before anything visible happens. If your backups only go back a week, every one of them may already be infected.
Stolen passwords still work. A restore doesn't change any credentials, so an attacker who took them can log straight back in.
You lose legitimate changes. Orders, form entries and content added since the backup are gone unless someone carries them across.
The warnings stay up. Google and other blocklists won't clear the site until they recheck it.
A restore works best as one step in the full process, where you pick a backup you're confident predates the compromise, restore it and then patch, rotate credentials and request reviews.
How we handle hacked sites
Our emergency website help is open to sites we don't host, and during business hours we start triage within the hour. We take a copy of the infected site before touching anything, find the entry point, and tell you what the cleanup involves and what it will cost before we start it. For sites on a Hosterr plan, backups go back 30 days, which helps when a backdoor has been sitting for a few weeks, and we restore the same day you ask.
Frequently asked questions
It depends on how far the infection spread, how long it's been there and whether there's a clean backup to work from. A recent hack with a known entry point and good backups can be a few hours of work, while a site infected for months with no usable backups takes much longer. Get a quote before work starts, and be wary of a flat price that doesn't include finding the entry point.
Sometimes, if the infection is simple and you're comfortable with SFTP, the database and server logs. The risk is missing one backdoor and having to do it all again a few weeks later. If the site takes payments or stores customer data, get help, because you may also have legal obligations to notify the people affected.
Usually, once it's clean and the warning is lifted. Rankings tend to come back as the spam pages drop out of the index and Google recrawls your real pages, which can take a few weeks. Request the review as soon as the cleanup is done, because traffic stays down while the warning is up.