Skip to content
RedWebDesign
WordPress security

Cleaning an infected WordPress site: what an expert does, and what you can do

WordPress is the most widely used website platform in the world, so it is also the one attackers target most. In this article I show you how they get in, where they hide the malware, what I do step by step during a cleanup, and what you can safely do yourself.

Ferenc KulcsárUpdated: 30 October 2026Reading time: about 5 min

Green streams of digits swirling on a black background

How do attackers get in?

The vast majority of hacks are not targeted attacks. Automated programs scan the web looking for sites that run a plugin or theme with a known vulnerability. The most common ways in:

  • An outdated plugin or theme. In one of my cases, a malicious file was uploaded through a gap in a form plugin that had not been updated for two years.
  • A cracked (“nulled”) theme or plugin. Premium themes downloaded for free almost always contain a back door. In one online shop, the infection was in the site from the day it launched.
  • A weak or leaked password, without two-factor authentication.
  • Old, still active access: accounts of former developers, marketers and subcontractors.
  • An infected neighbour: if several sites run on one hosting account, one hacked site can infect the others.

Where does the malware hide?

Malware is rarely a single file, and almost never in plain sight. Typical hiding places:

  • The uploads folder (wp-content/uploads): PHP files disguised as images or with random names.
  • The theme’s functions.php file and deeper, harmless-looking files of the theme.
  • WordPress’s own system files, for example the beginning of index.php or wp-config.php.
  • The .htaccess file, where the redirects come from.
  • The must-use plugins folder (mu-plugins), whose contents do not show in the usual plugin list.
  • The database: code injected into posts, settings or widgets, and hidden administrator accounts.
  • Scheduled tasks (cron) that regularly write the deleted code back.

That is why deleting the visible malware is not enough: if a single hiding place remains, the infection comes back within days.

Why is a security plugin not enough?

Security plugins such as Wordfence are useful: they compare files with the official versions and flag known malware. They are good for prevention, but limited on a site that has already been hacked:

  • they run inside an infected WordPress that the attacker also controls,
  • they often miss code hidden in the database and in scheduled tasks,
  • they do not find out how the attacker got in, and do not close the gap,
  • the “fix” button removes the symptom, but not always the back door.

This is how I clean a WordPress site

  1. Assessment. What the symptoms are, since when, whether there is a backup, and what changed on the site before the problem.
  2. Quarantine and backup. I take the site offline for visitors (maintenance mode or IP-based restriction) and save the infected state, the database and the server logs. They show what happened.
  3. Locking down access. New passwords for the hosting, the database, FTP and API keys, and new WordPress security keys (salts), so everyone is logged out. I remove suspicious administrators.
  4. Finding the entry point. The logs show where the attack came from. I disable the vulnerable plugin or service.
  5. Clean reinstallation. I reinstall the WordPress system files and plugins from the official source, rather than repairing them from the infected copy.
  6. Cleaning the content. I remove PHP files from the uploads folder, weed out injected code from the database and review the scheduled tasks.
  7. Hardening. Firewall, correct file permissions, two-factor authentication, removal of unnecessary plugins and themes.
  8. Checks and blacklists. Tests, then a review request with Google and, where needed, other lists.
  9. Final report. You get a written account of what happened, how they got in, what I fixed, and what to do so it does not happen again.

For an average site, the technical work takes a few hours. You can find the prices in the article on the first 24 hours and on the Website doctor page.

What can you safely do yourself?

There are things you can do without an expert, and they help a lot:

  • Make a backup of the current state before touching anything.
  • Change the passwords from a clean computer and turn on two-factor authentication.
  • Go through the user list and write down the unknown ones. Do not delete them, because they are evidence.
  • Run a scan with a security plugin and save the result.
  • Tell your hosting provider.

How to keep it clean

After the cleanup, the biggest risk is that everything slips back into the old routine: updates are skipped, backups go unchecked, old access stays active. I have collected what to do in the security checklist. If you have no time for it, my maintenance service does it for you.

Is your WordPress site infected? I find out how they got in, clean the site, and tell you in writing what happened.

Frequently asked questions

Will I lose my content during the cleanup?

Usually not. I reinstall the system files and plugins; posts, pages, images and orders remain. What can be lost is what the malware itself deleted or overwrote, if there is no clean backup of it.

Someone else built my site. Can you still help?

Yes. It does not matter who built it or which theme it uses. I need the hosting login details; if necessary, I can create WordPress administrator access from the hosting account.

What if my site uses a cracked (“nulled”) theme?

It has to be replaced with a licensed copy. Cracked themes almost always contain a back door, and as long as it stays on the site, the cleanup is only temporary. If you insist on keeping it, I cannot give a guarantee.

How long does the cleanup take?

For an average site, the technical work takes a few hours; in my recent jobs it was between 3.5 and 8 hours. The review by Google and other lists comes on top of that, and can take from 24 hours to a week.

Share Facebook LinkedIn
Ferenc Kulcsár
Ferenc Kulcsár I have been building, fixing and running websites for businesses since 2006. About me