DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
No Result
View All Result
DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
DroidCrunch

WordPress Malware Removal: How to Clean a Hacked Site, Step by Step 2026

Lokesh Kapoor by Lokesh Kapoor
November 30, 2026
3
0

If your WordPress site redirects visitors, shows spam or got flagged by Google, it’s probably infected. Cleaning it is a clear sequence: back up, find everything infected, replace what you can’t trust, then lock the doors.

We planted five common infections on a test site, from a backdoor in uploads to a hidden admin, then found and removed all five. One check found the modified core file in under a second. The hidden admin didn’t show on the Users screen at all.

Signs your WordPress site is hacked

Infections are designed to hide, so the signs are often indirect:

  • Visitors (especially on mobile or from Google) get redirected to spam or scam sites.
  • Google Search shows spammy titles or foreign-language pages under your domain.
  • Browsers or Google show a “This site may be hacked” or “Deceptive site ahead” warning.
  • New admin users you didn’t create, or your own password stops working.
  • Your host suspends the site or emails about malware or high resource use.
  • Unknown files in your uploads folder, or plugins you didn’t install.
  • Pages load a script from a domain you don’t recognise.

Some of these only appear to logged-out visitors, which is why owners miss them for weeks.

Common types of WordPress malware

Knowing what you’re dealing with tells you where to look first.

TypeWhat you noticeWhere it usually hides
Redirect malwareVisitors sent to scam or spam sites, often only from Google or on mobile.htaccess, wp-config.php, theme header, options table
SEO spamSpammy or foreign-language pages under your domain in GoogleA PHP page generator in uploads or a plugin folder
Credit card skimmerCustomers report card fraud after buyingCheckout page scripts, theme footer, options table
Backdoor (web shell)Nothing, until the infection returnsUploads, mu-plugins, theme and plugin files
Rogue adminUnknown administrators, or none visible but strange changesUsers table, hidden by code
Mailer or minerHost warnings about CPU or outgoing emailUploads, tmp folders, cron jobs
The infection types we see most often on WordPress sites.

Redirect malware is the most common. It usually lives in .htaccess, wp-config.php, the theme’s header or the database options table, and often only fires for logged-out visitors arriving from search engines, so the owner never sees it.

SEO spam creates thousands of pages under your domain, often in another language, to sell knock-off goods. You’ll see them in Google before you see them on the site. They’re often served by a single PHP file that generates pages on the fly.

Credit card skimmers target WooCommerce checkout pages. They add a script that copies card details as customers type. They’re small, often loaded from a lookalike domain, and the most damaging infection on this list.

Backdoors are what bring infections back. A single small PHP file that runs whatever code the attacker sends is enough. Most sites have more than one after a real hack.

Rogue admin accounts give the attacker a normal login, which survives file clean-ups. Hidden ones, like the one in our test, are designed to survive an owner’s check too.

Mailers and miners use your server to send spam email or mine cryptocurrency. The sign is usually a host warning about resource use or email blocklisting.

What we tested

We installed a fresh copy of WordPress 7.1.5 on a test server, then added five harmless samples that mimic real infections. None of the samples could run: each “malicious” line sat inside code that never executes. The point was to see how each one looks to the site owner, and what finds it.

Sample we plantedWhereWhat it mimics
PHP backdoor named like a cache fileA dated folder inside wp-content/uploadsA web shell that runs code sent by the attacker
Extra line in a core filewp-includes/plugin.phpMalware injected into WordPress itself
Must-use pluginwp-content/mu-plugins/Code that always runs and isn’t on the Plugins screen
Hidden admin accountDatabase (wp_users)An attacker’s way back in
Spam script in a postDatabase (wp_posts)Injected redirects and spam scripts
All samples were inert: each malicious-looking line sat inside code that never runs.

Then we ran each detection step below and timed the clean-up.

CheckWhat it foundTime
Core checksum comparison (3,338 files)1 modified file: wp-includes/plugin.phpUnder 1 second
PHP files in uploads1 file: the backdoorInstant
Must-use plugins folder1 unknown pluginInstant
Admins in the database vs the Users screen2 in the database, 1 on screenInstant
Database search for <script1 infected postInstant
Pattern search (eval, base64_decode and similar)109 files, 106 of them clean coreUnder 1 second
Our detection run took 0.58 seconds in total. The scripted clean-up that followed took 6 seconds; by hand it would take much longer.
WordPress malware detection results: checksums found the modified core file, database check found the hidden admin and injected script
Our test: five planted infections and the check that caught each one. The Users screen showed one admin; the database showed two.

Three lessons from the test:

  1. Core checksums are the fastest, most precise check. WordPress publishes the expected fingerprint of every core file. Comparing 3,338 files took under a second and flagged exactly one: the file we’d modified.
  2. Searching for “eval” or “base64_decode” alone is noisy. Our search found 109 PHP files with those patterns. After cleaning, 106 were still there, because a clean WordPress core uses those functions legitimately. Use pattern searches to narrow down, not to decide.
  3. The Users screen can lie. Our hidden must-use plugin filtered the rogue admin out of the Users list, which showed one administrator. The database showed two.

Before you start: contain the damage

Do these first, in this order:

  1. Put the site in maintenance mode or ask your host to take it offline, if it’s actively redirecting visitors.
  2. Change your hosting, SFTP and database passwords from a clean device. If the attacker has those, everything else is wasted.
  3. Take a full backup of the infected site, files and database. It sounds backwards, but if the clean-up breaks something, you need a copy to recover content from. Our infected backup was a 105 KB database dump and a 35.6 MB archive of files. Label it clearly as infected.
  4. Check whether you have a clean backup from before the infection. If you do and know when the hack happened, restoring it may be faster. You’ll still need the hardening steps, or it’ll happen again.

Tools you’ll need

You don’t need anything exotic. For our test, we used:

  • An SFTP client or your host’s file manager, to delete and upload files.
  • A database tool such as phpMyAdmin, which most hosts include, to list users and search content.
  • WordPress.org’s published checksums for your version, for comparing core files.
  • A fresh copy of WordPress in the same version as your site, from wordpress.org.
  • WordPress’s security key generator, to create new keys for wp-config.php.
  • A text editor that shows hidden characters and long lines, for checking wp-config.php and .htaccess.

A security plugin with a file scanner adds a useful second opinion, and your host’s own malware scanner can see files a plugin can’t. If you’re comfortable with a command line, your host’s SSH access makes searching files much faster.

How to remove malware from WordPress, step by step

The steps at a glance

  1. 1
    Step 1 of 10

    Back up the infected site

    Export the database and download all files, and label the backup as infected. You’ll need it if the clean-up removes something you want to keep.

  2. 2
    Step 2 of 10

    Replace WordPress core files

    Download the same WordPress version from wordpress.org. Delete wp-admin and wp-includes, then upload fresh copies, along with the root PHP files except wp-config.php. This removes any injected core code in one move.

  3. 3
    Step 3 of 10

    Reinstall plugins and themes from trusted sources

    Delete and reinstall every plugin and theme from wordpress.org or the vendor. Delete any you don’t recognise or don’t use. Don’t restore them from the infected backup.

  4. 4
    Step 4 of 10

    Remove backdoors from wp-content

    Delete PHP files in uploads, check mu-plugins and drop-in files, and review your theme’s recently changed files. In our test, this removed the uploads backdoor and the hidden plugin.

  5. 5
    Step 5 of 10

    Remove rogue users

    List administrators directly in the database and delete any you don’t recognise, reassigning their content to your account. Then check the Users screen again.

  6. 6
    Step 6 of 10

    Clean the database

    Search posts, pages, widgets and the options table for script tags, iframes and unfamiliar domains, and remove the injected code. Take care to remove only the injected part.

  7. 7
    Step 7 of 10

    Reset passwords and security keys

    Change every admin password, log out all sessions, and replace the security keys in wp-config.php with new ones from WordPress’s key generator. That invalidates any stolen login cookies.

  8. 8
    Step 8 of 10

    Check wp-config.php and .htaccess

    Compare them with a clean sample. Remove unfamiliar includes, redirects or long encoded strings.

  9. 9
    Step 9 of 10

    Scan again and verify

    Re-run the checksum check, a malware scanner and a logged-out test of the site on mobile. In our test, every check came back clean and the site loaded normally.

  10. 10
    Step 10 of 10

    Harden the site

    Add define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php, block PHP in uploads, turn on two-factor authentication and set up offsite backups.

WordPress malware removal steps: back up, replace core, remove backdoors, remove rogue users, clean database, reset keys, harden
The order matters: back up first, harden last.

How to find infected files without special tools

You don’t need a paid scanner to find most infections, but you do need to know where to look.

Compare core files against official checksums

WordPress.org publishes an MD5 fingerprint for every file in each release. Download the list for your version and language, then compare each file in wp-admin, wp-includes and the root folder. Any mismatch is a modified file, and any extra PHP file in those folders shouldn’t be there.

Many security plugins do this for you. Your host may offer it too. The point is the method: checksums tell you exactly which core files changed, with no guesswork.

Look for PHP files in uploads

The uploads folder should hold images, PDFs and other media. A PHP file in uploads is almost always malicious. In our test, the backdoor was named like a cache file in the current month’s folder, exactly where a real one tends to hide.

Check must-use plugins and drop-ins

The wp-content/mu-plugins folder runs automatically and doesn’t appear on the normal Plugins screen. Attackers like it for that reason. Check it, along with drop-in files directly in wp-content, such as object-cache.php or advanced-cache.php, which should match what your caching setup installed.

Check users in the database, not just the dashboard

Open your database tool (most hosts include phpMyAdmin) and list every user with the administrator role. Compare it with the Users screen. Any account that’s in the database but not on the screen is being hidden, which means there’s also malicious code doing the hiding.

Search the database for injected scripts

Search posts, pages, widgets and options for <script and for unfamiliar domains. In our test, the spam script was added straight to the database, bypassing WordPress’s own filtering, so it only showed up in a database search and in the page source.

Check recently modified files

Sort files by modification date and look at anything changed around the time problems started. Attackers sometimes fake file dates, so treat this as a hint, not proof.

LocationWhat to look for
wp-admin, wp-includes, root filesAny file that doesn’t match official checksums, or extra PHP files
wp-content/uploadsAny .php file
wp-content/mu-pluginsAnything you didn’t install
wp-content rootUnexpected drop-ins or PHP files
Active theme folderRecently changed functions.php, header.php or footer.php
wp-config.php and .htaccessUnfamiliar includes, redirects or encoded strings
Database: usersAdministrators you don’t recognise
Database: posts and optionsScript tags, iframes or unfamiliar domains
The places infections hide most often.

Extra steps for WooCommerce stores

If your site takes payments, a hack is more serious, and the clean-up has extra steps.

  • Check checkout pages first. Load the checkout as a logged-out customer, view the page source, and look for scripts from domains you don’t recognise. Skimmers often hide in the theme’s footer, a custom HTML widget or the options table.
  • Check payment gateway plugin files against fresh copies from the vendor.
  • Tell your payment processor. They can help you work out whether card data was exposed and what you need to do next.
  • Consider your customers. If card or personal data may have been taken, you may need to notify customers and regulators. Get advice before you make any public statement.
  • Rotate API keys for payment, shipping and email services stored in WordPress, because the attacker may have read them.

If you have several sites on one hosting account

On shared hosting, sites in the same account can usually read each other’s files. If one is infected, assume all of them might be. Clean every site in the account at the same time, or the clean ones get reinfected from the one you missed. Old test sites and forgotten installs in subfolders are common culprits.

Cleaning SEO spam out of Google

Removing spam pages from your server is only half the job. Google may keep showing them for weeks.

  1. Make sure the spam URLs return a 404 or 410 error. Check a few in a private window. If they still load, the generator file is still there.
  2. Check your sitemap for URLs you didn’t create, and regenerate it.
  3. Check Search Console for unknown owners or users. Attackers sometimes verify themselves to submit spam sitemaps. Remove them.
  4. Use the Removals tool in Search Console for the worst URLs, to hide them from results while Google recrawls.
  5. Request a review if there’s a security issue listed.

What our test didn’t cover

Our lab used five inert samples on a fresh site. Real infections are messier: obfuscated code, many backdoors, infected plugin files, and malware in places we didn’t plant anything, such as the database’s scheduled tasks or server cron jobs. Treat our results as a demonstration of the method, not a complete list of what to expect. If a real clean-up doesn’t hold, assume there’s something you haven’t found yet.

Should you use a malware scanner plugin?

Yes, as a second opinion. Scanners know thousands of malware signatures that a manual check won’t recognise, and they can watch for changes going forward. Our guide to the best WordPress security plugins compares the main options.

Three cautions:

  • A scanner can’t clean what it can’t reach. If the infection has admin access, it can switch off or fool a plugin running on the same site. Run server-side scans from your host too.
  • “Clean” doesn’t mean secure. Removing files without fixing how the attacker got in leads to reinfection.
  • Install it after you’ve changed passwords. Otherwise the attacker may still be watching.

If you’d rather hand the job over, a malware removal service like Virusdie scans and cleans from the server side. Our Virusdie review covers how it works.

Manual clean-up, plugin or paid service?

There are three ways to get the job done. The right one depends on your skills, your budget and how bad the infection is.

RouteCostSkill neededBest for
Manual (the steps above)Free, plus your timeComfortable with files, SFTP and a database toolSmall sites, obvious infections, recent backups
Security plugin scan and repairFree to paid annual licenceLow to moderateFinding known malware and repairing core files
Professional clean-up serviceOne-off fee or subscriptionNoneStores, repeat infections, no server access
Most site owners combine a manual check with a scanner as a second opinion.

For a small blog with an obvious infection and a recent backup, the manual route works well, especially with a free scanner as a cross-check. For a store, a site that’s been reinfected, or anyone who doesn’t want to touch a database, a service is money well spent. Many security plugins sit in between: they find and repair common problems, but rely on you for the rest.

Whichever route you take, the hardening steps afterwards are the same, and they’re what stop the next infection.

After the clean-up: request a review

If Google flagged your site, sign in to Google Search Console, open the Security issues report, confirm the problems are fixed, and request a review. Google usually reviews within days. Check other blocklists your security tool reports, and ask your host to lift any suspension.

Then watch the site closely for two weeks. Reinfection within days means a backdoor was missed or the entry point is still open.

How to stop it happening again

Most WordPress hacks come through a few doors. Close them all.

  • Update everything. Outdated plugins and themes are the most common way in. Turn on automatic updates for minor releases and trusted plugins.
  • Delete what you don’t use. Deactivated plugins and unused themes can still be exploited.
  • Turn on two-factor authentication for every admin. Our explainer on two-factor authentication covers the options.
  • Use unique, strong passwords for WordPress, hosting, SFTP and the database.
  • Disable the file editor. Adding DISALLOW_FILE_EDIT to wp-config.php, as we did, stops anyone with admin access editing theme and plugin code from the dashboard.
  • Block PHP in uploads with a server rule. We added an .htaccess rule for Apache; on Nginx, your host can add the equivalent.
  • Keep offsite backups on a schedule, and test a restore. See our list of WordPress backup plugins.
  • Install a security plugin for login protection, scanning and alerts. Solid Security (formerly iThemes Security) and Jetpack are common choices; our Kadence Security Pro review covers another.

A simple security routine

Most WordPress hacks start with something a few minutes of routine maintenance would have caught. This schedule is enough for most small sites.

How oftenTask
WeeklyApply plugin, theme and core updates; check the security plugin’s alerts
MonthlyReview administrator accounts; delete unused plugins and themes; confirm backups ran
Every three monthsTest restoring a backup to a staging site; review who has hosting and SFTP access
After any change of staff or developerRemove their accounts and change shared passwords
A routine that catches most problems before they become infections.

Put it in your calendar. A missed plugin update is the single most common way a WordPress site gets hacked, and it’s also the easiest to prevent.

Troubleshooting the clean-up

The site shows a critical error after replacing core files. A plugin or theme may depend on a modified file, or you copied files from a different WordPress version. Check the PHP error log, and make sure the fresh download matches your version. Our guide to fixing “there has been a critical error on this website” walks through it.

The redirect still happens for visitors but not for you. Many infections only redirect logged-out visitors, visitors from Google, or mobile users. Test in a private window, on mobile data, and by clicking through from a Google result. Check .htaccess, wp-config.php and the database options table for injected redirects.

The hidden admin comes back. Something is recreating it, usually a backdoor in a plugin, theme or must-use plugin, or a scheduled task. Search the database’s options table for unfamiliar scheduled events and recheck mu-plugins.

Google still shows the warning. Request a review in Search Console after cleaning. The warning stays until Google rechecks.

Your host keeps suspending the site. Ask for the exact file paths their scanner flagged. Hosts often have better visibility than a plugin.

When to call a professional

Get help if:

  • The site handles payments or personal data, and you may have a legal duty to report a breach.
  • Reinfection happens after you’ve followed every step.
  • You can’t access the server or database.
  • The site earns money every hour it’s down.

A professional clean-up costs money, but less than repeated downtime or a breach notification.

Heads-up: our Virusdie, Solid Security and Jetpack links are affiliate links. If you buy through them, DroidCrunch earns a commission at no extra cost to you.

Frequently asked questions

How did my WordPress site get hacked?

Most often through an outdated plugin or theme with a known vulnerability, a weak or reused password, or a compromised hosting account. Less often through a nulled premium plugin with malware built in. Your host’s access logs around the infection date can show which file was hit first.

Can I just restore a backup instead of cleaning?

Yes, if you have a backup from before the infection and know roughly when it happened. You’ll lose changes made since. Restoring doesn’t fix the vulnerability, so update everything, change all passwords and harden the site straight away, or it will be reinfected.

Will deleting the infected plugin remove the malware?

Rarely on its own. Attackers usually plant backdoors in several places, such as uploads, must-use plugins and the database, so the site can be reinfected after the original hole is closed. Follow the full clean-up, not just the plugin removal.

How long does WordPress malware removal take?

For a small site, a careful manual clean-up takes a few hours, most of it checking files and the database. Our scripted test took seconds because we knew exactly what we’d planted. Professional services typically clean a site within a day.

Is my visitors’ data at risk if my site was hacked?

Possibly. If the site stores customer accounts, orders or form submissions, the attacker may have accessed them. Depending on where you and your visitors are, you may have a legal duty to report a breach. Get advice if personal or payment data was involved.

Do free security plugins remove malware?

Most free plugins detect malware and some can repair core files, but full cleaning is usually a paid feature or service. A free scanner plus the manual steps above is enough for many small sites. Use a paid service if the infection keeps returning.

How do I know the malware is completely gone?

Core checksums match, no PHP files sit in uploads, every administrator is someone you recognise, the database has no injected scripts, and logged-out visitors on mobile see no redirects. Then watch for two weeks. If nothing returns, the clean-up worked.

Should I tell Google my site was hacked?

Only if Google flagged it. In that case, fix the site, then request a review in Search Console’s Security issues report. If Google didn’t flag it, there’s nothing to report, but check Search Console for spam pages indexed under your domain.

The bottom line

Cleaning a hacked WordPress site follows the same order every time: contain, back up, replace core, remove backdoors and rogue users, clean the database, reset secrets, then harden. In our test, checksums found the modified core file instantly, while the hidden admin only showed up in the database.

Don’t stop at removing files. Close the way in, turn on two-factor authentication, keep backups, and watch the site for two weeks afterwards.

Summarize this article with AI

Get the key points in seconds. Pick an assistant and it opens in a new tab, ready to go.

ChatGPTClaudePerplexityGoogle AIGrokMistral

Opens in a new tab. Nothing is shared until you pick an assistant.

Share4Tweet2Share1Share
Previous Post

WordPress.com vs WordPress.org: The Real Difference 2026

Lokesh Kapoor

Lokesh Kapoor

I am Lokesh Kapoor who loves to write blogs, create videos and watch sci-fi movies on Netflix and Jio Cinema. DroidCrunch is my first love and a crucial part of my life.

Related Posts

WordPress.com vs WordPress.org: title card showing self-hosted server and hosted cloud options

WordPress.com vs WordPress.org: The Real Difference 2026

November 30, 2026
297
Is WordPress free: title card with a website window and a cost receipt

Is WordPress Free? What It Really Costs to Run a Site 2026

November 30, 2026
298
How much does web hosting cost: title card with a hosting price card showing a renewal increase

How Much Does Web Hosting Cost? Real Prices and Renewals 2026

November 29, 2026
301
ERR_SSL_PROTOCOL_ERROR: title card with a browser window showing a broken padlock and a failed connection to a server

ERR_SSL_PROTOCOL_ERROR: What Causes It and How to Fix It 2026

November 29, 2026
301
Load More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

DroidCrunch

Tested first. Then written.

Independent software reviews since 2016. Search the archive, or start with a topic.

WordPressAI toolsHostingVPNSEO
  • 640+reviews, comparisons and guides
  • 243product reviews
  • 36topics covered
  • 2016publishing since
home

An independent tech blog and YouTube channel. We use every tool before we rate it, and we always tell you the catch.

Topics

  • WordPress
  • AI tools
  • Hosting
  • SEO
  • VPN
  • Proxies
  • Automation

Company

  • About DroidCrunch
  • Editorial policy
  • Affiliate disclaimer
  • Write for us
  • Contact

Explore

  • All articles
  • Reviews
  • Deals and coupons
  • Black FridayLive
  • Facebook group
  • Help and support

Recently scored

  • miniOrange Secure MCP Server75%
  • Royal MCP80%
  • WPVibe76%
  • Zapier82%
All reviews

Reader-supportedWhen you buy through our links, we may earn a commission at no extra cost to you. It never changes our verdicts. Read our affiliate disclaimer.

© 2026 DroidCrunch. Independent since 2016.

  • Privacy policy
  • Terms
  • Cookie policy
  • Your GDPR rights
  • RSS
Back to top

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
Subscribe
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact

© 2026 DroidCrunch - Best Place for Tech NomadPrivacy PolicyTerms & ConditionsCookie PolicyGDPR RightsAffiliate Disclosure

DroidCrunch Giveaway

Amazon Gift Card worth $15

Participate now and get a chance to become a lucky winner to receive the reward.​

Join Giveaway