WordPress Malware Removal Guide 2026

How to remove WordPress malware for real: contain the infection, restore or clean carefully, rescan, rotate access, and close the hole so it does not come back.

Topics Malware & cleanup Beginner guides

Lars Koudal

Updated Published

Malware removal is not a magic “scan and forget” button. The goal is a clean site that stays clean: stop the damage, get trustworthy files online, and close whatever let them in.

WordPress malware removal

First: confirm and contain

Typical signs: redirects, spam you did not add, new admins, lockouts, browser or Search Console warnings. More detail: 7 signs of a hack and common malware traits.

Containment checklist

  1. Put the site in maintenance mode (or take it offline) if visitors are being harmed
  2. Contact the host; ask about snapshots, mail abuse, and server-level malware
  3. Work from a clean device if credentials may be stolen
  4. Do not keep publishing content through an infected install

Prefer a clean backup restore

If you know when the infection started, restoring files + database from before that point is usually cleaner than hunting every backdoor by hand.

Then immediately:

  1. Update WordPress, plugins, and themes
  2. Delete unused plugins/themes
  3. Rotate all admin (and hosting) passwords
  4. Enable 2FA
  5. Scan again before celebrating

A restore that still contains the malware, or leaves the same vulnerable plugin active, just rewinds the movie. Backup habits: backup plan.

If you must clean without a clean backup

You need file access (hosting panel, SFTP, or SSH). wp-admin may be unreliable.

1. Users and plugins

  • Remove unknown administrator accounts
  • Delete shady plugins you do not recognize (especially ones you never installed)
  • Check must-use plugins (wp-content/mu-plugins/) and drop-ins

2. High-value files

Inspect and compare:

  • wp-config.php (odd eval, remote includes, unexpected admins created in code)
  • .htaccess in root and uploads (redirects, auto_prepend)
  • Theme functions.php and unexpected PHP in uploads
  • Cron / scheduled tasks that call remote URLs

3. Core integrity

WordPress core should match official copies. Core Scanner flags modified, missing, or unexpected core files. Unexpected PHP outside normal theme/plugin paths deserves suspicion.

4. Malware scan, then judgment

Run a malware scanner, review findings, clean or whitelist carefully. False positives happen (especially with unusual but legitimate plugins). Do not mass-delete without understanding the path.

Watch the walkthrough above for how scanning looks in Security Ninja.

5. Database leftovers

File cleanup is not enough if spam content, rogue options, or injected users remain in the database. Search for odd scripts in posts/widgets, unexpected siteurl/home changes, and unknown users.

6. Rescan before you reopen the site

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.

After cleanup: close the door

Malware that “keeps coming back” almost always means the entry point is still open.

Common causes:

  • Vulnerable or abandoned plugin/theme
  • Weak or reused admin password
  • No 2FA on privileged accounts
  • Nulled software
  • Old WordPress core

Fix that, then harden:

Full recovery flow: what to do if your site is hacked.

Places malware loves to hide

Keep these on your mental map while cleaning:

  • wp-content/uploads/ PHP files (uploads should rarely need executable PHP)
  • Cached / optimized copies of infected templates
  • Old theme directories you thought you deleted
  • Database wp_options rows with base64 blobs or remote URLs
  • Cron events calling unknown PHP files

If reinfection happens within hours, assume a backdoor or the same vulnerable plugin is still present.

Google Safe Browsing and SEO

If Chrome or Search Console flagged the site:

  1. Finish cleaning first
  2. Request a review in Search Console
  3. Expect rankings to take time to recover

Google’s hacked site guidance is useful after the install is actually clean.

When to hire help

DIY is fine for a simple restore. Hire help when:

  • You are locked out of wp-admin and hosting access is unclear
  • Malware returns after “cleanup”
  • Customer data may be involved
  • The store or lead site cannot stay down while you learn

We offer fixed-price malware cleanup and security review.

Prevention so you are not here again

  • Keep plugins few and updated
  • Unique passwords + 2FA for admins
  • Firewall + scheduled scanning
  • Off-site backups you have restore-tested

Security Ninja Pro combines malware scanning, cloud firewall, login hardening, and scheduled scans so cleanup is not your only strategy.

YouTube

Related video

Watch how to scan WordPress for malware with WP Security Ninja.

Found this useful? Share it.