WordPress Malware Removal Guide 2026
How to remove WordPress malware: contain the infection, clean or restore, rescan, rotate access, and close the hole so it does not come back.
Topics Malware & cleanup Beginner guides
How to remove WordPress malware: contain the infection, clean or restore, rescan, rotate access, and close the hole so it does not come back.
Topics Malware & cleanup Beginner guides
How to remove malware from WordPress: contain the damage, prefer a clean restore, then scan and remove what is left, rotate access, and close the hole so it does not return. Malware removal is not a magic “scan and forget” button. The goal is a clean site that stays clean.
Work in this order: contain → assess → clean or restore → harden. Skipping containment or leaving the entry point open is why infections “keep coming back.”
Not sure whether you are compromised yet? Start with check if your WordPress site is hacked or the longer signs guide.
Knowing the shape of the infection helps you look in the right places.
| Type | What it does | Common cues |
|---|---|---|
| Backdoor / webshell | Keeps remote admin access after you “clean” | Unknown admins, odd PHP in uploads/themes, reinfection in hours |
| Injection | Malicious code dropped into themes, plugins, posts, or options | Spam links, hidden iframes, eval / base64 blobs in files or the DB |
| Redirect malware | Sends visitors (sometimes only mobile or logged-out) elsewhere | Search Console / browser warnings, conditional redirects |
| Spam / SEO spam | Injects pages, comments, or mail abuse | New content you did not write, host spam complaints |
| Crypto / resource abuse | Burns CPU for someone else’s gain | Sudden CPU spikes, timeouts, host resource warnings |
Warning signs (several together matter more than one alone):
More detail: 7 signs of a hack and common malware traits.
How malware usually gets in: outdated or abandoned plugins/themes, nulled plugins, weak or reused admin passwords, infected shared hosting neighbors, and social-engineering “updates.” Close that door after cleanup or you will do this again.
You need file and database access. If wp-admin is dead, use the hosting panel, SFTP/SSH, or an authorized emergency recovery hook, then remove that code the moment you are in.
wp-config.phpSecurity Ninja Pro’s malware scanner and Core Scanner help here: flag suspicious files, and show modified, missing, or unexpected core files. Free builds still cover security tests, vulnerability checks, and core integrity. Judgment still matters. False positives happen; do not mass-delete without understanding the path.
Watch the walkthrough above for how scanning looks in Security Ninja.
If you know when the infection started, restoring files and database from before that point is usually cleaner than hunting every backdoor by hand.
Then immediately:
A restore that still contains the malware, or leaves the same vulnerable plugin active, just rewinds the movie. Backup habits: backup plan.
You need file access. wp-admin may be unreliable.
wp-content/mu-plugins/) and drop-insInspect and compare:
wp-config.php (odd eval, remote includes, unexpected admins created in code).htaccess in root and uploads (redirects, auto_prepend)functions.php and unexpected PHP in uploadsfavicon.ico, double extensions, PHP next to images)WordPress core should match official copies. Core Scanner flags modified, missing, or unexpected core files. Unexpected PHP outside normal theme/plugin paths deserves suspicion. When in doubt, replace core from a trusted WordPress package (never overwrite wp-config.php or wp-content blindly).
Run a malware scanner, review findings, clean or whitelist carefully. False positives happen (especially with unusual but legitimate plugins).
File cleanup is not enough if spam content, rogue options, or injected users remain. Search for odd scripts in posts/widgets, unexpected siteurl / home changes, unknown users, and option values with base64 blobs or remote URLs. Export a DB backup before you edit anything.
Run malware and vulnerability scans again after cleanup. Check the site logged out and in a private window. Confirm mail is not still sending spam. Only then remove maintenance mode.
wp-content/uploads/ PHP files (uploads should rarely need executable PHP)wp_options rows with base64 blobs or remote URLsIf reinfection happens within hours, assume a backdoor or the same vulnerable plugin is still present.
Malware that “keeps coming back” almost always means the entry point is still open.
Common causes:
Fix that, then harden:
755, files 644, wp-config.php tighter such as 600 when your host allows it)Full recovery flow: what to do if your site is hacked.
If Chrome or Search Console flagged the site:
Google’s hacked site guidance is useful after the install is actually clean. SEO recovery notes: recover after a hack.
DIY is fine for a simple restore. Hire help when:
We offer fixed-price malware cleanup and security review.
Security Ninja Pro combines malware scanning, cloud firewall, login hardening, and scheduled scans so cleanup is not your only strategy. Free covers tests, vulnerability checks, and core scanning to catch problems earlier.
Watch how to scan WordPress for malware with WP Security Ninja.
Found this useful? Share it.
Contain the site first, prefer a clean backup restore when you have one, otherwise scan and remove carefully, rotate all credentials, close the entry point, then harden with updates, strong logins, firewall, and scheduled scans. A single scan click is not enough if the backdoor remains.
Work from a clean device, take the site offline or into maintenance if visitors are harmed, restore from a known-good backup when possible, or remove confirmed malicious files and database injections while documenting what you change. Rescan after cleanup and watch for reinfection.
Usually a backdoor, stolen admin credentials, or an unpatched plugin remains. Clean files without rotating passwords and closing the entry hole invites reinfection within hours.