
Short answer: WordPress malware removal starts with a backup and new passwords. Then you scan the files and the database, replace WordPress core, plugins and themes with clean copies, and remove unknown admin users and backdoors. Finish by rotating salts, updating everything, and adding a firewall so the same hole can't be used again.
If your site is redirecting visitors to spam, showing a "This site may be hacked" warning in Google, or your host has flagged malware, this guide walks you through each step. You can do it yourself if you're comfortable with SFTP and phpMyAdmin or WP-CLI. If you're not, it shows you when to call in a professional.
How do I know if my WordPress site has malware?
Malware is often quiet. Watch for these signs:
- Visitors are redirected to spam, scam or "you won a prize" pages, sometimes only on mobile or only when they arrive from Google.
- Google Search shows "This site may be hacked", or Chrome shows a red warning page.
- New admin users you didn't create appear under Users.
- Unfamiliar PHP files appear in
wp-content/uploadsor the site root. .htaccess,wp-config.phpor theme files changed without anyone touching them.- Pages contain injected JavaScript, hidden links or spam keywords.
- Your host reports malware, high resource usage, or outgoing spam from your account.
- Antivirus software warns visitors when they open your site.
You can also check from outside: Google Search Console's Security issues report shows whether Google has detected hacked content on your site.
How do I remove malware from WordPress? (step by step)
Work through these steps in order. Skipping the "boring" ones, like passwords and backdoors, is the most common reason sites get reinfected.
1. Take a full backup first
Back up files and the database, even though they're infected. If something goes wrong during cleanup, you can go back, and the backup helps you work out how the attacker got in. Store it off the server.
2. Put the site in maintenance mode and change passwords
Change every password that could give access: hosting control panel, SFTP/SSH, database user, and all WordPress admin accounts. If the database password changes, update it in wp-config.php.
3. Scan files and the database
Use a malware scanner to get a list of suspicious files and injected code. Scanners differ in where they run: some run inside WordPress as a plugin, others scan remotely or in the cloud, so they keep working even when the site itself is compromised. Treat the results as a starting point, not a guarantee. Obfuscated backdoors are designed to avoid detection.
4. Replace WordPress core with a clean copy
Don't try to clean core files by hand. Replace them. With WP-CLI you can check core files against the official checksums and reinstall them:
wp core verify-checksums
wp core download --force --skip-content
Without WP-CLI, download the same WordPress version from wordpress.org and upload everything except wp-content and wp-config.php.
5. Reinstall plugins and themes from official sources
Delete and reinstall every plugin and theme from wordpress.org or the vendor. For plugins from wordpress.org, WP-CLI can compare files with the official versions:
wp plugin verify-checksums --all
Remove plugins and themes you don't use. Nulled (pirated) premium plugins are a common source of infections, so replace them with licensed copies or remove them.
6. Hunt for backdoors
Attackers usually leave a way back in. Check these places:
- PHP files in
wp-content/uploads, which normally holds only media:
find wp-content/uploads -name "*.php"
wp-content/mu-plugins(must-use plugins load automatically and are easy to miss).htaccessfiles in any folder (look for redirect rules you didn't add)wp-config.php(look for code that doesn't belong, such aseval,base64_decodeor long encoded strings)- Recently modified files compared with the date the problem started
7. Clean the database
Check the siteurl and home values in wp_options, look for injected <script> tags or hidden links in posts and widgets, and review any unfamiliar entries in the options table. Back up before running search-and-replace queries.
8. Remove unknown users and reset sessions
List administrators and delete any you don't recognize:
wp user list --role=administrator
Then generate new security keys and salts. This logs everyone out, including the attacker:
wp config shuffle-salts
Without WP-CLI, paste fresh keys from the official WordPress salt generator into wp-config.php.
9. Update everything and close the hole
Update WordPress core, every plugin and theme, and your PHP version if it's no longer supported. Then look for the root cause: an outdated plugin, a weak password, a compromised SFTP account or another site on the same hosting account.
10. Ask Google to review the site
If Google flagged your site, open the Security issues report in Google Search Console, confirm the issues are fixed, and click Request Review. Google's Security issues report help page explains the review process.
Can I remove WordPress malware for free?
Yes, if you have the time and the technical skills. Every step above can be done with free tools: WP-CLI, a free scanner, clean copies of WordPress and your plugins, and Google Search Console. What you pay for with a service is speed, experience with hidden backdoors, and someone else taking responsibility for the cleanup.
What is the best WordPress malware removal plugin or service?
It depends on what you need:
- A scanner to find problems: most security plugins and platforms include malware scanning. Cloud or remote scanners have the advantage that they don't use your server's resources and keep working when WordPress itself is compromised.
- Someone to clean the site for you: hands-on cleanup services, where a security team removes the infection, suit site owners who don't want to do it themselves.
- Protection after the cleanup: a firewall that blocks the attacks that caused the infection, plus hardening and regular updates.
Many site owners combine a scanner and a firewall day to day, and use a cleanup service when something gets through. If you're comparing security plugins, see our Wordfence alternatives in 2026 comparison.
How much does WordPress malware removal cost?
Doing it yourself costs time rather than money. Professional services usually charge per incident or as a yearly subscription that includes cleanups. For example, Sucuri's Website Security Platform starts at $229/year for one site and includes unlimited malware and hack removals, with a 30-hour removal SLA on the Basic plan, according to its pricing page. Prices and response times vary by provider and plan, so compare what's included before an emergency.
How do I stop WordPress malware from coming back?
Reinfections usually happen because the original hole is still open. (For the most common entry points, see why WordPress sites get hacked.) After a cleanup:
- Keep core, plugins and themes updated, and remove anything you don't use.
- Use strong, unique passwords and two-factor authentication for every admin.
- Put a web application firewall (WAF) in front of the site so exploit attempts are blocked before they reach WordPress.
- Scan regularly, so a new infection is caught in days, not months.
- Keep off-site backups you can restore from.
- Limit admin accounts and give people only the role they need.
Where PhantomGuard fits
PhantomGuard covers finding malware early, cleaning it up and keeping attackers from getting back in. PhantomGuard Premium includes:
- Cloud malware scanning that runs outside your server, so it doesn't add load to your hosting.
- Automatic cleanup: when the scanner finds infected files, PhantomGuard can clean or quarantine them automatically.
- An edge WAF, CDN and DDoS protection that filters malicious requests before they reach WordPress.
- WordPress hardening for logins, core files and permissions.
- A dashboard with reports, custom security rules and priority support.
Premium is PhantomGuard's only paid plan. Your first month is free with code PG_PRO, then it's $5/mo billed annually ($60/year) as an introductory price, and the plan renews automatically. See the details on the pricing page. You can also run a free site check to see how exposed your site is.
Frequently asked questions
How long does WordPress malware removal take?
A simple infection can take an hour or two if you know what you're doing. A site with several backdoors, database injections and a Google warning can take a day or more, plus a few days for Google's review.
Will deleting the infected plugin remove the malware?
Rarely on its own. Attackers usually spread code to other files, add admin users or leave backdoors in uploads. Follow the full checklist above.
Can I just restore a backup?
Yes, if you have a clean backup from before the infection. But restore alone doesn't fix the hole that let the attacker in, so update everything and change passwords afterwards.
Does my host remove malware for me?
Some hosts include malware scanning or cleanup in certain plans, others only notify you or suspend the site. Check your plan or ask support.
Does PhantomGuard remove malware or only detect it?
PhantomGuard Premium does both. When the cloud scanner finds infected files, PhantomGuard can clean or quarantine them automatically. You should still change passwords, remove unknown admins and close the hole the attacker used, as described in the steps above.
Will a hacked WordPress site hurt my SEO?
It can. Spam pages, redirects and Google warnings can reduce traffic and rankings. Cleaning up quickly and requesting a review in Search Console limits the damage.
Clean it once, then keep it clean
Malware removal is stressful the first time and much easier the second, especially if you have backups, a scanner and a firewall in place before you need them.
Get your first month of PhantomGuard Premium free with code PG_PRO (then $5/mo, billed $60/year, renews automatically). See pricing or read more about WordPress malware removal.