Do not panic-delete the whole site. Do not restore the newest backup until you know whether that backup is already infected. Do not keep using the same weak admin password “just for now”. Most reinfections are not mysterious — they are unfinished cleanups.
Warning signs include Google Search Console messages that the site may be hacked, Chrome telling visitors the site is not safe, redirects to unknown domains, spammy links injected into posts, a suddenly slow site, an inaccessible admin, or odd server-load spikes from cryptojacking. If you see any of these, treat the site as compromised until proven clean.
Also check your outbound email reputation and hosting abuse notices. Many owners discover a hack only when the host suspends the account for sending spam. In that case the public site may still “look fine” while a hidden mailer script runs from an uploads folder. Contain first; argue with the host later, with evidence.
1. Confirm the compromise and contain it
Capture screenshots of warnings, note the time you first noticed symptoms, and list recent plugin installs or shared logins. If the site is actively redirecting visitors or serving phishing pages, put it into maintenance mode or temporarily suspend the site at the host so fewer people are harmed while you work.
Change the passwords on your hosting panel and email from a clean device. If your own computer might be infected, do not type WordPress credentials there. Ask your host whether they see suspicious cron jobs, outbound spam, or unknown FTP users. Containment is boring; skipping it is how the attacker watches you clean up in real time.
2. Preserve evidence and take a forensic backup
Before you delete anything, download a full copy of the files and database as they stand. Label it clearly as a forensic snapshot. You may need it to compare timestamps, recover a clean post the attacker overwrote, or prove what happened. A “clean” restore from last week is useful later — but only after you know when the infection started.
Export a list of WordPress users and their roles if you can still reach the database (phpMyAdmin or similar). Look for unknown administrators. Attackers love creating a spare admin account named something almost legitimate.
3. Scan core, plugins, themes and the database
Compare WordPress core files against a clean copy of the same version. Unexpected changes in wp-includes or wp-admin are a red flag. Scan wp-content/uploads for PHP files — uploads should not contain executable PHP in a healthy install. Review recently modified files by timestamp; malware often lands in odd directories with random names.
In the database, search wp_posts and wp_options for injected scripts, unfamiliar domains, and spam eval payloads. Check wp_users for rogue admins. Review wp_options rows such as siteurl and home in case they were pointed at a phishing domain. If you use a reputable malware scanner, run it — but treat scanners as assistants, not proof of cleanliness. Many backdoors are custom and quiet.
Inspect server cron and WordPress cron carefully. Unexpected curl commands, base64-encoded PHP run via cron, or unknown scheduled actions in a cron plugin are classic persistence tricks. Disable suspicious jobs before you declare the site clean.
4. Remove malware and every backdoor
Delete malicious files, replace infected core and plugin files with clean copies from wordpress.org or the vendor, and remove rogue users. Reinstall WordPress core over the top if needed. Update every plugin and theme you keep; delete anything abandoned or unknown.
Assume a backdoor exists. Industry reporting regularly finds that a large share of attacks — around 69.6% in widely cited datasets — leave a way back in. Backdoors hide in must-use plugins (mu-plugins), scheduled cron tasks, theme footer injections, and database options. If you only delete the visible spam page, the attacker returns within days. That is why incomplete DIY cleanups feel cursed.
When restoring from backup, restore only to a point before the earliest evidence of compromise, then re-apply legitimate content changes manually if needed. Restoring yesterday’s backup when the attacker arrived last month simply reinstalls the backdoor with a nicer homepage. After restore, still rotate every password and salt — credentials may have been stolen even if the files look clean.