Skip to content
Hire Me Login
STOP THE REINFECTION

WordPress Site Keeps Getting Hacked? Why It Comes Back and How to Stop It

You cleaned it. Maybe you paid someone to clean it. Two weeks later the spam pages, redirects or strange admin users are back. That’s not bad luck. Something got left behind.

By Md Juwel Rana, WordPress Developer · · 11 min read

Break one link and the loop stops.

Here’s a story I hear all the time. Someone’s site gets hacked. They install a security plugin, run a scan, delete what it flags, and everything looks fine. Then a few weeks later, Google shows Japanese spam under their domain again.

If your WordPress site keeps getting hacked, the first cleanup didn’t fail by accident. It missed something. Usually one of two things: a piece of malware that can rebuild the rest, or the original way in, which is still wide open.

I’m Md Juwel Rana, a WordPress developer at Web Relife. Below I’ll walk you through why reinfections happen, where the leftovers hide, and the order I use to stop a site from getting hacked over and over.

Why Does My WordPress Site Keep Getting Hacked?

Short answer: when a WordPress site keeps getting hacked, either a backdoor survived the cleanup and re-creates the malware, or the hole the attacker used (an old plugin, a stolen password, another infected site on the same server) was never closed. Usually it’s both.

And the holes aren’t rare. Patchstack’s yearly report counted thousands of new WordPress vulnerabilities in 2024 alone:

0new WordPress vulnerabilities found in 2024
0of them were in plugins, not WordPress core
0weren’t fixed by the time they went public
0needed no login at all to exploit

Source: Patchstack, State of WordPress Security in 2025.

So if your WordPress site keeps getting hacked, an outdated or abandoned plugin is the first suspect. It’s basically an unlocked door. And attackers move fast. Patchstack notes some flaws were being attacked within hours of going public.

WordPress site keeps getting hacked: the reinfection loop of hack, cleanup and reinfection
When a WordPress site keeps getting hacked, it’s a loop. You have to break it, not just clean it.

9 Reasons a WordPress Site Keeps Getting Hacked

If your WordPress site keeps getting hacked, go through these honestly. Most reinfected sites I’ve seen have at least two.

1

A backdoor survived

Modern malware keeps spare copies. In 2026 Sucuri found one strain that stored itself in at least eight places, including mu-plugins, advanced-cache.php, db.php, a theme’s functions.php and even the database. Delete one copy and another restores it. (Details here.)

2

A cron job puts it back

A scheduled task, either in cPanel’s Cron Jobs or inside WordPress, downloads the malware again every few minutes or every day. Scanners don’t read cron jobs, so they never flag it.

3

Other sites on the same account

Got an old test site, a client’s site or an abandoned blog in the same hosting account? If one is infected, it can reinfect all the others. Cleaning just one is pointless.

4

The vulnerable plugin is still there

Even deactivated plugins can be attacked if the files are still on the server. Some plugins are abandoned and will never get a fix.

5

Nulled themes or plugins

“Free” copies of premium plugins very often come with a backdoor built in. Every reinstall puts the hack right back.

6

Passwords weren’t all changed

Changing the WordPress password isn’t enough. If the hosting, FTP, database or email password leaked, the attacker just walks back in.

7

A hidden admin account

Malware can hide an administrator from the Users list. I wrote a full guide on finding and removing hacked admin users.

8

Your own computer is infected

Malware on a PC can steal passwords saved in FTP apps and browsers. You change the password, it steals the new one.

9

A PHP-level loader

A tiny .user.ini or .htaccess change can load a malicious file before WordPress even starts. It doesn’t look like part of WordPress, so people skip it.

WordPress site keeps getting hacked even after two cleanups? Let me find what’s left.

Get Help Now

Where Malware Hides When a WordPress Site Keeps Getting Hacked

When a WordPress site keeps getting hacked, check every one of these places, not just the ones a scanner reports.

WhereWhat to look for
wp-content/mu-plugins/Any file you didn’t add. Many sites don’t use this folder at all.
wp-content/advanced-cache.php, db.php, object-cache.phpThese “drop-ins” are normal only if a cache plugin made them. Unknown ones are suspicious.
wp-content/uploads/Any .php file. Uploads should only hold images and documents.
Site root.user.ini with auto_prepend_file, fake core files, odd names like wp-user.php
Theme functions.phpLong encoded strings, eval, base64_decode, wp_insert_user
Database (wp_options, posts)Injected scripts, unknown autoloaded options, spam posts
Cron jobs (cPanel and WP-Cron)Jobs that download from an IP address or run files from /tmp

How to Stop a WordPress Site That Keeps Getting Hacked: 8 Steps

When a WordPress site keeps getting hacked, the order matters. If you clean files while a cron job is still running, it just puts them back.

Back up, then take stock of the whole account

Download a full backup (files and database), infected or not. Then list every site, folder and database in the hosting account. Every one of them is now part of the cleanup. Delete old sites you don’t need.

Kill the cron jobs first

In cPanel go to Cron Jobs (in Plesk, Scheduled Tasks) and delete anything you don’t recognize. Inside WordPress, a free plugin like WP Crontrol shows scheduled events. Remove unknown ones. If you’re on a VPS, ask your host to check the server-level cron too, because you may not be able to see it.

Replace, don’t repair

Don’t try to clean infected core, plugin or theme files line by line. Delete them and upload fresh copies:

  • WordPress core: fresh wp-admin and wp-includes, plus the root files (keep wp-config.php).
  • Plugins and themes: delete the folders and reinstall from WordPress.org or the developer’s site. Never from a “free download” site.

Hunt the hiding spots

Go through the table above by hand. Remove PHP files from uploads, check mu-plugins, drop-ins and .user.ini, and search the database for injected scripts. A scanner helps, but it’s the files the scanner misses that explain why a WordPress site keeps getting hacked.

Remove rogue users

Check every administrator in the database, not just the Users screen. Delete the code that creates them first, then the users.

Change every credential at once

WordPress users, hosting, FTP/SFTP, database (update wp-config.php), and the email account tied to the admin. Then generate new salts with the WordPress salt generator so every old session dies. Do it from a computer you trust.

Close the door they used

Update everything. Delete inactive plugins and themes completely. Replace any plugin that’s abandoned or has an unpatched flaw. If you can’t figure out how they got in, assume it was a plugin and update or replace all of them.

Watch it for two weeks

Turn on file-change alerts and an activity log. Search Google for site:yourdomain.com every few days to catch spam pages early. If something comes back, you’ll know quickly and you’ll know exactly which file changed. Plenty of times a WordPress site keeps getting hacked simply because nobody was watching after the cleanup.

Harden It So Your WordPress Site Stops Getting Hacked

Once it’s clean, make it harder to get back in. These two changes alone block a lot of common reinfections.

Stop PHP from running in uploads. Create a file named .htaccess inside wp-content/uploads/ (Apache or LiteSpeed servers) with:

<Files *.php> Require all denied </Files>

Turn off the built-in file editor. Add this to wp-config.php, above the “That’s all, stop editing” line:

define( ‘DISALLOW_FILE_EDIT’, true ); // no theme/plugin editing from wp-admin
When to rebuild instead: if a WordPress site keeps getting hacked after a full, careful cleanup, sometimes the cheaper move is a fresh install with only your content imported, on new hosting. My migration service can handle that move cleanly. And if you’re locked out right now, start with getting back into a hacked WordPress site.

Want Me to Break the Loop for You?

If your WordPress site keeps getting hacked and you’re tired of cleaning it, send it to me. I don’t just run a scan. I go through the whole hosting account, find every copy and every way back in, and lock it down.

  • Full account check, including other sites and cron jobs
  • Remove backdoors, drop-ins, hidden admins and database injections
  • Replace core, plugins and themes with clean copies
  • Rotate every password and security key
  • Harden uploads, logins and file editing so it stays clean

Frequently Asked Questions

Why does my WordPress site keep getting hacked after cleaning?
Something was left behind. Usually a backdoor that restores the malware, a cron job that downloads it again, another infected site on the same hosting account, or the original vulnerable plugin or leaked password that was never fixed.
Can a security plugin stop my site from getting hacked again?
It helps, but it’s not enough on its own. Scanners miss cron jobs, some database injections and well-hidden backdoors. You also need updates, unique passwords, two-factor login and a firewall.
Can other websites on my hosting account reinfect my site?
Yes. Sites in the same hosting account usually share file access. If one is infected, the malware can spread to the others. Clean or delete all of them together.
Will restoring a backup fix a WordPress site that keeps getting hacked?
Only if the backup is from before the infection and you also close the way in. A restore doesn’t remove server cron jobs or fix a vulnerable plugin, so the site can get hacked again quickly.
Should I change hosting if my site keeps getting hacked?
Sometimes. If you’ve cleaned carefully and it still returns, or your host can’t check server-level cron jobs and other accounts, moving to a clean server with a fresh WordPress install is often faster.
How long should I monitor after cleaning?
At least two weeks closely, then keep file-change alerts and an activity log running permanently. Reinfections often show up a few days to a couple of weeks after a cleanup.
JR
Md Juwel Rana is a full stack WordPress developer at Web Relife. He’s spent over 10 years fixing hacked and broken WordPress sites, email problems and WooCommerce stores. Need a hand? Hire me here.