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.
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:
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.
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.
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.)
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.
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.
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.
Nulled themes or plugins
“Free” copies of premium plugins very often come with a backdoor built in. Every reinstall puts the hack right back.
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.
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.
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.
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 NowWhere 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.
| Where | What 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.php | These “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.php | Long 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-adminandwp-includes, plus the root files (keepwp-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:
Turn off the built-in file editor. Add this to wp-config.php, above the “That’s all, stop editing” line:
- Two-factor login for every admin.
- A web application firewall (Wordfence, Cloudflare or your host’s).
- Auto-updates for plugins you trust, and a weekly check for the rest.
- A supported PHP version. Old PHP means old, unpatched code.
- Daily off-site backups, so the worst case is a restore, not a rebuild.
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