A free manual by Delvok

WordPress malware cleanup, the honest DIY manual

To clean malware from WordPress yourself: back up the infected site, take it offline to visitors, replace WordPress core, plugins and themes with fresh copies from their source, hunt the backdoors in uploads, mu-plugins, .htaccess, the database and cron, remove rogue administrators, rotate every password and salt, update everything, then ask Google to review the site.

Removing the malware you can see is the easy half. Cleanups fail on what gets left behind: a second backdoor, a payload in the database, or the way in that nobody closed.

Before step 1

Make sure it really is malware

Plenty of things look like a hack and are not: a plugin update that broke a page, an expired domain, a hosting outage. These four signs, on the other hand, almost always mean an infection.

Redirects only some visitors see

People on phones, or arriving from Google, get sent to spam or scam pages. You, logged in on a desktop, see nothing wrong. That selectiveness is deliberate.

Pages you never wrote, in Google

Search site:yourdomain.com. Pharmacy, casino, replica-goods or Japanese-language listings under your domain are spam pages injected into the site.

A warning from someone else

A red "Deceptive site ahead" screen, a Security issues notice in Search Console, a suspension email from your host, or mail bouncing because the domain is on a blocklist.

Admins and files nobody added

An administrator you do not recognise, PHP files inside the uploads folder, or a plugin nobody remembers installing.

Check what the outside world sees

A free remote scan: Google Safe Browsing, spam blocklists, injected code in the page source, security headers and exposed WordPress endpoints. Run it now, and again when you finish step 10. It only sees the public surface, so a clean result does not clear the files or the database.

The manual

The cleanup, room by room

Ten steps, in this order, and the order matters. Change passwords while a backdoor is still in place and the attacker simply reads the new ones. Ask Google for a review before the site is clean and the request is turned down. Commands use WP-CLI where it saves time; every step can also be done over SFTP and phpMyAdmin.

  1. Back up the infected site before you change anything

    Copy every file and export the database, exactly as they are now, malware included. This copy is your evidence and your way back if a cleanup step breaks the site. It is not something you restore later without thinking: if the infection is weeks old, every recent backup your host made has the same malware in it.

    • Full copy of the files plus a database export
    • Stored off the server, never inside the web root
    • Labelled "infected" so nobody restores it by accident
    wp db export ~/before-cleanup.sql
    # then download it and delete the server copy

    Where this goes wrong: Hosts often keep only 7 to 30 days of backups. Infections usually start before anyone notices them, so the "clean" restore point may already be gone.

  2. Take the site offline to visitors and lock the outer doors

    While you work, visitors should not be redirected to spam or served infected scripts. Use a maintenance page set at the server or hosting panel, not a WordPress plugin: a plugin runs inside the compromised install and can be bypassed by it. Then change the hosting panel password and look for SFTP, SSH or database users you did not create.

    • Server-level maintenance page or 503
    • Hosting panel password changed from a clean device
    • Unknown SFTP, SSH and database users removed

    Where this goes wrong: Running the cleanup from a computer that is itself infected, or from a browser with a saved, leaked password, undoes everything that follows.

  3. Replace WordPress core from a fresh download

    Do not hunt through core files line by line. Ask WordPress which files differ from the official release, then replace wp-admin, wp-includes and the root files with a fresh copy of the same version from wordpress.org. Keep wp-config.php, but read it top to bottom yourself: an extra include or a long encoded string near the top is a classic hiding place.

    • Checksums compared against the official release
    • wp-admin and wp-includes replaced wholesale
    • wp-config.php read by hand, line by line
    wp core verify-checksums
    wp core download --force --skip-content --version=$(wp core version)

    Where this goes wrong: Extra files the checksum report lists as "should not exist" are not harmless leftovers. Find out what each one is before deleting it.

  4. Reinstall every plugin and theme from its source

    Treat every plugin and theme folder on the server as untrusted. Reinstall free ones from wordpress.org and paid ones from the vendor account you bought them from, never from the copy already on the server and never from a "nulled" download. Delete anything inactive or abandoned outright: an old plugin you forgot about is one of the most common ways in.

    • Free plugins checked against wordpress.org checksums
    • Premium plugins and themes downloaded fresh from the vendor
    • Inactive, unknown and abandoned folders deleted
    wp plugin verify-checksums --all
    wp plugin install <slug> --force

    Where this goes wrong: Some malware installs itself as a plugin and hides from the Plugins screen. Compare the folders in wp-content/plugins with the list WordPress shows you.

  5. Hunt the backdoors hiding in the file system

    The visible infection is usually the noisy part. The backdoor that lets the attacker back in is small, quiet and placed where nobody looks. Check the places that load code without appearing anywhere in the dashboard, and anything that changed recently.

    • PHP files inside wp-content/uploads (there should be none)
    • wp-content/mu-plugins, which loads automatically and is easy to miss
    • Drop-ins such as object-cache.php, advanced-cache.php and db.php
    • .htaccess and .user.ini rules, including auto_prepend_file
    find wp-content/uploads -type f -name "*.php*"
    ls -la wp-content/mu-plugins
    find . -type f -name "*.php" -mtime -30

    Where this goes wrong: Attackers set file dates to match the files around them, so "modified recently" finds only the careless ones. Use it as a lead, not a verdict.

  6. Search the database and the scheduled tasks

    Files are only half the site. Malware also lives in the database, where file scanners never look: encoded payloads in wp_options rows that load on every page, scripts injected into post content, and a changed siteurl. Then check WP-Cron and the server crontab for jobs that quietly reinstall everything you just removed.

    • The largest autoloaded rows in wp_options
    • Script tags and hidden links inside wp_posts content
    • siteurl and home still pointing at your own domain
    • WP-Cron events and the server crontab you did not create
    wp db query "SELECT option_name, LENGTH(option_value) AS size FROM wp_options WHERE autoload IN ('yes','on') ORDER BY size DESC LIMIT 20"
    wp db search "<script" --all-tables
    wp cron event list

    Where this goes wrong: Your table prefix may not be wp_. Check $table_prefix in wp-config.php, and never delete an option you cannot identify without the backup from step 1 in hand.

  7. Remove rogue administrators

    List every user with administrator rights and question each one. Attackers create accounts with believable names like "support" or "wpadmin", and some quietly add powerful capabilities to an ordinary subscriber account, so it never appears in a list of administrators. Delete what you cannot vouch for and reassign its content to a real person.

    • Every administrator account accounted for
    • Subscriber and customer accounts checked for elevated capabilities
    • Application passwords reviewed on the accounts you keep
    wp user list --role=administrator --fields=ID,user_login,user_email,user_registered

    Where this goes wrong: Deleting the account is not enough while its login session is still valid. That is what step 8 is for.

  8. Rotate every password and every salt

    Assume every credential the site could read has been copied. Change them after the removal work, not before, or a surviving backdoor simply reads the new ones. Start with the hosting panel and work inward. New salts in wp-config.php sign everyone out, the attacker included.

    • Hosting panel, SFTP and SSH
    • Database password, updated in wp-config.php
    • Every WordPress administrator, plus the email inboxes they reset to
    • Keys saved in plugins: SMTP, payment, CDN, backup storage
    wp config shuffle-salts

    Where this goes wrong: Reusing a password from another site, or from before the hack, hands the attacker the new door key.

  9. Update everything and close the way they got in

    A cleanup that does not find the entry point has only reset the clock. Update core, every plugin and theme, and the PHP version. Then work out how they got in: a known-vulnerable plugin, a reused password, an abandoned theme, or another site in the same hosting account. If you cannot name the cause, assume the door is still open and harden accordingly.

    • WordPress, plugins, themes and PHP fully updated
    • The likely entry point named and fixed
    • File editing disabled and two-factor login on every administrator
    • Old staging copies and forgotten installs in the same account removed
    wp config set DISALLOW_FILE_EDIT true --raw

    Where this goes wrong: One infected site in a shared hosting account can reinfect every other site in it. A forgotten /old or /dev folder counts.

  10. Request reviews, then keep watching

    Only once the site is clean, ask for the warnings to come off. In Google Search Console, open Security issues and request a review, saying what you found and what you fixed. Remove or return 410 for any spam pages that got indexed, and resubmit your sitemap. Check Spamhaus and other blocklists your email depends on. Then watch closely for a few weeks: new files, new admins, new redirects.

    • Search Console review requested, with a clear explanation
    • Spam URLs removed from the index and the sitemap resubmitted
    • Blocklists checked, delisting requested where needed
    • Files and admin users rechecked weekly for a month

    Where this goes wrong: Requesting a review while anything is still infected gets the request rejected and can slow down the next one. Google sets its own timeline; nobody can promise a date.

Where DIY cleanups fail

Most failed cleanups do not fail at the removal. They fail at what was left behind.

  1. A backdoor survives, and the site is reinfected within days

    Attackers rarely leave one way back in. Remove the obvious file and the quiet one in mu-plugins or wp_options reinstalls everything, often the same week.

  2. The malware is removed but the way in is not

    The vulnerable plugin, the reused password, the abandoned theme. Clean around an open door and the next automated scan walks straight back through it.

  3. The site goes back to the same compromised hosting

    A forgotten staging copy or second install in the same account, or a server that was itself the problem, will reinfect the cleaned site from next door.

  4. An infected backup gets restored

    The infection is usually older than the first symptom. Restoring last week’s backup can bring back exactly what you just removed.

  5. Deleting by pattern breaks the site

    Plenty of legitimate plugins use base64 and eval. Remove every match and the site breaks, and you still have not proven the malware is gone.

  6. A clean scan is mistaken for a clean site

    Remote scanners, ours included, see only the public surface. A backdoor that is waiting quietly shows nothing at all from the outside.

If the malware has already come back once, or you have found more than you expected, that is the moment to hand it over.

Have Delvok finish the cleanup
Your call

Do it yourself, or have us do it

Do it yourself

$0

Follow the ten steps above, in order.

  • Costs nothing but your time
  • Needs SFTP or SSH, database access, and ideally WP-CLI
  • Plan for most of a day on a small site
  • You own the risk of a missed backdoor or a broken site

Have Delvok do it

$1,250flat, launch pricing (normally $2,500)

Most rescues start the same day and are cleaned within 24 to 48 hours.

  • Inspection of files, database, users and scheduled tasks
  • Malware, backdoors and rogue accounts removed
  • WordPress hardened and the entry point closed
  • Google review requests handled for you
  • Moved to isolated managed hosting (from $150/mo after)
  • If malware reappears while we manage the site, we deal with it at no extra charge
“Amazing service. They were able to fix and take the malware off my site.”
Kim, wellness business owner
“They helped clean up my site after it was hacked. Quick and easy.”
David, medical practice owner
Questions

Asked before every cleanup

Can I do a WordPress malware cleanup myself?

Yes, if you can reach the files over SFTP or SSH, can open the database, and are willing to be methodical. The steps on this page are the same ones a professional follows. Where DIY cleanups usually fail is not the removal itself but the parts that are easy to skip: the second backdoor, the database payload, and the way in that nobody closed.

How long does a WordPress malware cleanup take?

Doing it yourself, plan for most of a day on a small site if you are comfortable with SSH and WP-CLI, and longer without them or on a large WooCommerce store. If Delvok does it, most rescues start the same day and the site is cleaned within 24 to 48 hours.

Will a security plugin clean the malware for me?

Partly. A security plugin runs inside the WordPress install it is trying to clean, so it can be disabled or fooled by what it is looking for. Plugins are good at spotting known malicious files; they are weaker at database payloads, server crontabs and code outside the WordPress folder. Use one as a second opinion, not as the cleanup.

Should I just restore an old backup instead?

Only if you know the backup is older than the infection, and only if you then fix how the attacker got in. Otherwise you restore the same backdoor, or the same vulnerable plugin, and the site is reinfected. Infections are often weeks old before the first symptom appears.

Why does the malware keep coming back after I clean it?

Almost always one of four reasons: a backdoor was missed, the entry point is still open, a scheduled task re-downloads the malware, or another infected site in the same hosting account is spreading it back. Reinfection within days points to something left behind, not to a new attack.

How do I get the Google warning removed after the cleanup?

Once the site is genuinely clean, open Security issues in Google Search Console, describe what you found and fixed, and request a review. Google decides how long the review takes. Anyone who promises a removal date is guessing.

What does it cost to have Delvok do the cleanup?

A Complete Malware Rescue is a flat $1,250 at launch pricing (normally $2,500). It covers inspection of files, database, users and scheduled tasks; removal of malware, backdoors and rogue accounts; hardening; Google review requests; and a move to isolated managed hosting, which continues from $150 a month.

Who wrote this manual?

Delvok, a WordPress malware rescue and secure hosting service. We clean infected WordPress sites for a living, and we would rather you fix yours properly than half-fix it. If you get stuck, or find more than you expected, we can take it from wherever you stopped.

Found more than you expected? Stop there.

Tell us what you found and which step you reached. Delvok finishes the cleanup, closes the way in and moves the site somewhere it is watched, for a flat $1,250.