WordPress site keeps getting hacked after cleanup: why it comes back

The site was cleaned, it works again, and a few days or weeks later the same symptoms are back. It is almost never bad luck. A cleanup removes what was planted; it does not necessarily remove what let it be planted, or what lets the attacker come back. This guide explains the three ways reinfection happens, where each one hides, and what to close so the hack stays gone.

Simon Vasconcelos Lee By Published on 22 November 202611-minute read

All guides

In short

  1. Reinfection comes from three things: a backdoor left in place, access that is still valid, or the original hole still open.
  2. Look for backdoors outside the places already cleaned: wp-content/uploads, mu-plugins, .user.ini files, scheduled tasks, the database.
  3. Reset every credential from a clean device: hosting, FTP and SFTP, database, WordPress accounts, application passwords, wp-config.php keys.
  4. Find the way in from the server logs, and close it: plugin updated or removed, account deleted.
  5. Check the other sites in the same hosting account: one infected site is enough to reinfect the others.
  6. A clean site stays clean when someone follows every vendor’s security fixes, week after week.

Cleaning is not closing

A cleanup answers "what was planted?": code that redirects, spam pages, a malicious script. Reinfection answers a different question: "how did it get in, and what lets it come back?" As long as that stays open, the site falls again, often with the same symptom. Three mechanisms nearly always explain it:

  1. A backdoor left in place: a small file or a few lines of code that let the attacker run whatever they want, no password needed. It is planted first, precisely to survive the cleanup.
  2. Access that is still valid: an administrator account created by the attacker, a stolen password that was never changed, a session still open.
  3. The original hole: the vulnerable plugin that let them in is still there, in the same version. The site is clean, the door is open, and bots try it again every day.

The cleanup is visible; closing the doors is not, and it is what matters. If your site has just been hacked, the hacked WordPress site page covers the first hour; this guide deals with what makes the hack come back.

Backdoors that survive a cleanup

A backdoor sits where a cleanup does not look: outside the core files that get replaced, outside the active theme, often somewhere that never shows in the admin area. Of the 39,594 sites its team cleaned in 2023, Sucuri found at least one on 49.21%: one hacked site in two.

LocationWhat you find thereHow to check it
wp-content/uploadsPHP files, sometimes disguised as images or tucked into a dated subfolderNo PHP file belongs there, apart from an empty index.php
wp-content/mu-pluginsA "must-use" plugin, loaded automatically and missing from the Plugins screenEvery file in this folder must be accounted for
.user.ini, php.ini, .htaccessAn auto_prepend_file directive that runs a file before every pageSearch the whole hosting account for the directive
wp-content/pluginsA plugin hidden from the admin list, or a file added inside a legitimate pluginCompare the folder with the list, and the files with the checksums
DatabaseCode in wp_options or in page content, a setting that loads a scriptSearch for <script, eval(, base64_decode(
Scheduled tasksA WP-Cron event that puts the code back at regular intervalsList the events, spot the unfamiliar names
Inactive themesAn old theme left installed, vulnerable or modifiedDelete every theme you do not use
Terminal, at the site root
find wp-content/uploads -name "*.php"
ls -la wp-content/mu-plugins
grep -rn "auto_prepend_file" --include=".user.ini" --include="php.ini" --include=".htaccess" ~
ls wp-content/plugins
wp plugin list --fields=name,status,version
wp plugin verify-checksums --all
wp cron event list

The third command searches the whole home directory of the hosting account, not just the site: a directive placed above the site’s folder still applies to it. Comparing the contents of the plugins folder with the WP-CLI list exposes a plugin that is on disk but missing from the list.

Access that is still valid

Changing the password on your own account does not close the access the attacker gave themselves. Each one has to be checked on its own:

Terminal
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered
wp user application-password list 1
wp config shuffle-salts

The second command lists the application passwords of user number 1: repeat it for each administrator, and revoke any that nobody created with wp user application-password delete.

Finding the way in

The original hole is the piece people look for least, and the one that matters most. Two clues point to it: the date of the first malicious file, and the requests the server received that day.

Terminal, for an intrusion spotted in the first week of October (adjust the dates): PHP files modified that week, then POST requests on the suspect day in the access log
find . -name "*.php" -newermt "2026-10-01" ! -newermt "2026-10-08"
grep "07/Oct/2026" access.log | grep "POST" | grep -v "wp-cron.php"

A burst of requests to a plugin file, to admin-ajax.php with an unusual parameter, or to xmlrpc.php, just before the first file appeared, points to the door. Then check each plugin and its version against the public vulnerability databases (WPScan, Patchstack, Wordfence Intelligence): a plugin flagged as vulnerable in the installed version is the prime suspect.

Plugins carry the bulk of the flaws. In 2025, Patchstack recorded 11,334 new vulnerabilities in the WordPress ecosystem, 91% of them in plugins and only 6 in core; 46% had no fix from their developer by the time they were made public. And attacks follow closely: for flaws exploited in 2025, Patchstack measures a weighted median of five hours to first exploit.

The number of plugins on a site gives the measure of its exposure. Across the 3664 SMB WordPress sites in our monthly survey, the median site depends on 3 different vendors, and 66% of sites run at least one plugin that is not in the public directory, whose updates go through a licence and the vendor’s own account. Let the licence lapse, and the plugin stops receiving its fixes.

Two special cases. A plugin removed from the WordPress.org directory over an unpatched flaw is not flagged in the site’s admin: it stays installed, with no update ever coming (1,614 plugins and themes were removed for that reason in 2024, according to Patchstack). And a premium plugin downloaded from anywhere other than its vendor (a so-called "nulled" version) routinely ships with its own malicious code, and never gets updated.

The neighbours in the same account

Several sites installed in the same hosting account usually share the same system user: a malicious file dropped by one can write into the others. An old test site, a previous version in an /old folder, an abandoned install on a subdomain: any of them can reinfect a site that has just been cleaned. List everything the account holds, and clean or delete every install, not just the one showing the symptom.

Cleaning a second time, in the right order

  1. Take the site offline or into maintenance mode, and make a copy of the infected state: it serves as evidence and as a point of comparison.
  2. Look for the way in before cleaning: logs get rotated away, and a cleanup wipes out the dates.
  3. Rebuild from clean sources: WordPress core, theme and plugins downloaded again from their vendors, never from the infected copy.
  4. Take only the content from the old site: the database, once checked, and the media folder stripped of every PHP file.
  5. Reset every credential from a clean device, then the keys in wp-config.php.
  6. Update everything, delete whatever is unused, and close the original hole.
  7. Monitor the site for several weeks: modified files, new accounts, redirects, the Security issues report in Search Console.

Restoring a backup is not a cleanup. The intrusion often happens days or weeks before the first symptoms: a recent backup may already contain the backdoor, and every backup contains the original hole.

What prevents a third time

A site that has been cleaned and closed becomes vulnerable again the day one of its plugins ships a fix that nobody applies. So the third infection is prevented less by a tool than by a person: someone who follows every vendor’s fixes, applies updates, keeps an eye on files and accounts, and checks the backups. If nobody in-house does that, it is the question to settle before any other.

A site taken over, so the hack stays gone

After two cleanups, the question becomes: who looks after the site from now on? Simafri takes over your WordPress site, puts it back online on a base we host, secure and keep up to date, and looks after it month after month. You keep your domain name and your content.

Have my site taken over

Frequently asked questions

Why does my WordPress site keep getting hacked after cleanup?

Because one of three causes is still there: a backdoor the cleanup missed, access that is still valid (an added administrator account, a stolen password, an application password), or the original hole, usually a vulnerable plugin still installed in the same version.

Is restoring a backup enough to get rid of a hack?

Rarely. The intrusion often comes days or weeks before the first symptoms: a recent backup may contain the backdoor, and every backup contains the hole the attacker came in through. Restoring without closing that hole puts the site back in the state that let the hack happen.

Isn’t changing the passwords enough?

No. A backdoor works without a password, an administrator account created by the attacker has its own, and application passwords are revoked separately. Change every credential from a clean device, delete unknown accounts, revoke application passwords and renew the keys in wp-config.php.

Should I switch hosts after being hacked twice?

The cause is almost always in the site itself: a vulnerable plugin, access that is still valid, a backdoor. Moving hosts while taking those along just moves the problem. Also check the other sites in the same account, which can reinfect the one you are cleaning.

Contact us