AI Audit Schedule a Call
Hacked Site Recovery November 29, 2026

How to Remove Malware From WordPress Manually

How to Remove Malware From WordPress Manually
On this page
  1. How do you remove malware from WordPress manually?
  2. What should you do before touching any files?
  3. How do you replace core, plugin and theme files without leaving anything behind?
  4. What do you check in the database, users and scheduled tasks?
  5. How do you log everyone out and reset every credential?
  6. How do you verify the cleanup worked?
  7. When is manual cleanup the wrong choice?
  8. Need a hand with a hacked WordPress site?
  9. Frequently asked questions

To remove malware from WordPress manually, back up the infected site, replace core files with a clean copy of the same version, reinstall every plugin and theme from trusted sources, check the database, users and scheduled tasks, then reset all credentials and verify. Skipping any one step is how malware comes back.

This is a WordPress malware removal guide for owners who are comfortable with SFTP and a command line. If you would rather hand it off, our hacked site repair service covers the same ground. Below is the sequence, the traps in each step, and the cases where doing it yourself is the wrong call.

How do you remove malware from WordPress manually?

Work in this order, because each step protects the next:

  1. Document the symptoms and take a snapshot of files and database, even though it is infected.
  2. Replace core files, then delete and reinstall plugins and themes from clean sources.
  3. Read the files attackers favor, then audit users, the database and scheduled events.
  4. Reset every password, change the salts and destroy active sessions.
  5. Verify with checksums and a scanner, then watch the site for reinfection.

That is the short version of the WordPress malware cleanup steps. The official WordPress.org FAQ on hacked sites admits its own steps “are not all encompassing”, so treat this as a baseline and not a guarantee.

Six-step sequence for manually cleaning a hacked WordPress site
Manual cleanup works best in this order.

What should you do before touching any files?

Write down what you can see before you change it. The WordPress.org FAQ lists the signs of a compromise: blacklisting by Google or Bing, a host disabling the site, a malware-distribution flag, visitors’ antivirus warnings, the site attacking other sites, unexpected new users, and visible defacement. It also tells owners to record symptoms, times with the timezone, and recent changes such as a new plugin or a theme edit. That list is your best lead on the entry point later.

Then back up the site as it is. The FAQ says to take “one more snapshot of the environment” before cleaning, even if it is infected, so a reference copy exists if cleanup fails badly. Label it infected so nobody restores it by accident. For the safe way to roll back later, see our guide to restoring a WordPress backup.

Older clean backups matter too. The WordPress Hardening handbook (updated October 14, 2026) recommends timed snapshots of the whole install and the database. Its example is a site compromised May 1 but detected May 12, where backups from before and after the compromise help you rebuild and analyze.

How do you replace core, plugin and theme files without leaving anything behind?

Reinstall the same WordPress version the site is running. The FAQ warns that an older or newer one is “likely to kill your website”. It also says not to use the reinstall options in WP-ADMIN. Those installers “often only overwrite existing files, and hacks often introduce new files”, so copy fresh files over SFTP instead. The FAQ says /wp-admin and /wp-includes can be replaced safely.

If you have WP-CLI, the “wp core download” command supports –force (overwrite existing files), –skip-content (leave out the default themes and plugins) and –version. Together they replace core without touching wp-content, though the handbook page has no examples for those flags, so try it on a copy first. Overwriting does not delete strays. Follow it with “wp core verify-checksums –include-root”, which compares files with WordPress.org’s checksums and warns about non-WordPress items in the root.

Be more diligent in wp-content, the FAQ says, because that is where theme and plugin files live. The safest habit is to delete each plugin and theme folder and reinstall it rather than overwrite it, for the same reason: overwriting leaves planted files behind. Premium plugin and theme files must come from the original developer, not from an old zip on your computer. Anything you keep from wp-content, such as uploads or custom code, needs a manual review.

AreaWhat to do
/wp-admin and /wp-includesReplace with a same-version copy over SFTP
Root filesRun core checksum verification with –include-root
PluginsDelete and reinstall; premium files from the developer
ThemesDelete and reinstall; read any custom edits line by line
.htaccess, index.php, header.php, footer.php, functions.phpRead every line for code you did not write

The FAQ calls .htaccess one of the more common files “most often updated and used for nefarious activities”, and it can sit in the root and several other directories, so check all of them. It says modified index.php, header.php, footer.php and “function.php” affect every page request. That last name is the FAQ’s spelling; WordPress themes use functions.php.

What do you check in the database, users and scheduled tasks?

Start with users, because a rogue administrator undoes everything else. Run “wp user list –role=administrator –format=csv” and remove any account you do not recognize. Our guide to spotting and removing a rogue admin goes deeper. If an attacker locked you out, the FAQ says to reset the password in the wp_users table through phpMyAdmin or Adminer, or change the account email and use “forgot password”.

For the database, “wp db check” runs mysqlcheck with your wp-config.php credentials. It checks table health only and is not a malware scan. The WordPress.org FAQ does not give a method for finding injected content in posts or options, and I found no official source that does, so this part relies on your own judgment. Look for scripts or links you did not add, and compare siteurl and home values with your real address.

For scheduled tasks, “wp cron event list” shows each hook with next_run_gmt, next_run_relative and recurrence. Flag hooks you cannot tie to a plugin you run. The handbook page covers listing only, not deleting, so check the WP-CLI cron documentation before removing anything. Also note that the sources I relied on do not say whether cron jobs are a common reinfection point; treat them as one place to look, not a proven one.

How do you log everyone out and reset every credential?

Force a password reset for all users, especially administrators, and change your FTP/SFTP, WP-ADMIN, hosting control panel and MySQL credentials, as the FAQ directs. To end existing logins, generate new secret keys from api.wordpress.org/secret-key/1.1/salt/ and overwrite them in wp-config.php, or run “wp config shuffle-salts”. Then destroy sessions with “wp user list –field=ID | xargs -n 1 wp user session destroy –all”.

The Hardening handbook links an article titled “How WordPress Uses Salts and Why You Should Not Rotate Them”, which suggests routine rotation is debated. After a compromise, the FAQ still recommends it.

The FAQ adds three more points. Change passwords again once the site is confirmed clean. Consider changing the database user and password, updating wp-config.php to match. And scan your own computer, because attackers may capture FTP and wp-admin logins through local trojans. Afterward, tighten permissions: the Hardening handbook suggests directories at 755, files at 644 and wp-config.php at 400 or 440. Our post-hack hardening checklist covers the rest.

How do you verify the cleanup worked?

Run “wp core verify-checksums –include-root” and “wp plugin verify-checksums –all”. The plugin command checks files against WordPress.org checksums, and –strict counts even small changes such as readme.txt edits as errors. Its documented success output reads “Success: Verified 8 of 8 plugins.” Because the checksums come from WordPress.org, premium and custom code fall outside this check. Atgler’s own scanning also compares file checksums against clean WordPress files, which gives accurate, current results, but it still cannot judge custom code by checksum alone.

Add a scanner as a second opinion. The FAQ lists the Quttera, GOTMLS, Wordfence and Sucuri plugins, plus VirusTotal and Sucuri SiteCheck as remote scanners, and says “No one solution is the best approach”. Our comparison of how to find a WordPress backdoor shows what scanners tend to miss.

Finally, close the entry point. Patchstack’s 2025 analysis (vendor-reported, undated page) says 33% of WordPress ecosystem vulnerabilities receive no patch at all. If your hole was an abandoned plugin, reinstalling it reopens the door. Replace it with a maintained alternative. The FAQ also points to Google and Bing webmaster consoles for blacklist status, but it does not walk through a review request, and I could not confirm review timelines.

When is manual cleanup the wrong choice?

It is the wrong choice when malware persists after you remove it. Sucuri, a vendor that sells cleanup services (article last updated February 23, 2024), describes PHP re-infectors that use persistent running processes, a modified wp-includes/plugin.php that recreates index.php and .htaccess, and fake plugins in wp-content/plugins that “will not be visible from wp-admin”. It also says malware “can persist in OPcache after being cleaned from the site files or database”, and infected files may be set to 444 permissions.

Shared servers raise the stakes. Sucuri says that when several sites share an account, “they will all need to be cleaned, otherwise they will likely reinfect each other”. Other warning signs:

  • Files you deleted reappear within hours or days.
  • You cannot source clean copies of premium plugin or theme files.
  • You have no SFTP or SSH access, or the host has disabled the site.
  • You need to know how the attacker got in. The FAQ calls forensics “very difficult for website owners” because of limited knowledge or data.

Free help exists: the FAQ points to the WordPress.org Hacked and Malware forums. Also be realistic about time. Atgler’s own thorough cleanup takes at least 8 hours of work, and hard cases on old, deprecated themes can run up to 50, so budget your own time honestly before starting.

Five signs that manual WordPress malware cleanup is the wrong approach
Reinfection and scope are the main signals.

Need a hand with a hacked WordPress site?

If the steps above look like more than you want to own, our hacked site repair follows one standard procedure on every infected site: it removes the malware, rebuilds core from clean files and patches the vulnerabilities we can identify. We do not promise to prove how a site was hacked, and an exact restore is not always possible if data was deleted or the database is lost. It is $149 Standard (48 hr) or $249 Priority (24 hr), a flat fee with a 30-day re-hack guarantee. For context first, see what malware removal typically costs.

Frequently asked questions

Can I remove malware from WordPress without a plugin?

Yes. Replacing core files over SFTP, reinstalling plugins and themes, and checking users and the database all work without a security plugin. Scanners are optional extras, and the WordPress.org FAQ says no single one is best.

Why not use the reinstall button in WP-ADMIN?

The FAQ says those installers often only overwrite existing files, while hacks often add new ones. Copying a clean same-version copy over SFTP, or checking with checksums afterward, catches what an overwrite leaves behind.

Do I need to change my database password too?

The FAQ says to consider it. If you change the database user and password, update wp-config.php to match, and change your hosting panel and SFTP passwords as well.

I am locked out of wp-admin. What now?

Reset the password in the wp_users table using phpMyAdmin or Adminer. Alternatively, change the account’s email address there and use the “forgot password” link.

Why does the malware keep coming back?

Sucuri, a vendor that sells cleanup, describes re-infectors such as modified core files, fake plugins hidden from wp-admin, and code cached in OPcache. Shared hosting accounts can also reinfect each other until every site is cleaned.

Sources