WordPress maintenance Hacked site cleanup Security plugin Pricing Security tips
Home / Security tips / Website security
April 30, 2026

Why Your WordPress Site Keeps Getting Hacked (And How to Stop It)

The spam pages are back. You deleted the strange files, changed your WordPress password, and watched the security scan turn green. Now your site is redirecting visitors again.

That doesn’t necessarily mean a new attack succeeded. The first attacker may never have lost access. A hidden account, a scheduled task, or a vulnerable plugin can survive a surface-level cleanup and put everything back.

The next move isn’t another round of deleting whatever looks suspicious. You need to work out what survived, how it got there, and which access routes are still open.


Save evidence before you start deleting

Pause for a moment. Cleanup changes the evidence you need to understand the break-in, especially file timestamps and database records.

Ask your host to preserve available access logs, error logs, and account activity. Save a snapshot of the current files and database too, clearly labelled as compromised. Keep it away from the live website, with restricted access. This is evidence, not a backup you should restore later.

Record what you noticed and when: an unexpected administrator, a redirect on mobile, or product descriptions replaced with links. Screenshots help. Your host’s logs may use a different time zone so write yours down.

If you’re still working out what’s wrong, these signs your WordPress site has been hacked can help you describe the symptoms. Don’t leave a harmful site public while investigating; ask your host about restricting access or serving a temporary maintenance page.


Find the entry point and the way back in

These are two different questions. A vulnerable upload feature might let someone in, while a backdoor they plant afterwards gives them continuing access even after that feature gets patched.

Compare suspicious requests in the logs with file changes, administrator activity, and the versions installed at the time. Check vulnerability reports for those exact plugin and theme versions. A suspicious filename alone won’t tell you how the attacker arrived.

Persistence needs a wider search:

  • Accounts: inspect all administrators, their email addresses, and unexpected application passwords. On Multisite, check super administrators too.
  • Files: inspect uploads, wp-config.php, server configuration files, and wp-content/mu-plugins. Must-use plugins load automatically and aren’t managed like ordinary plugins.
  • Scheduled tasks: review WordPress cron events and hosting-level cron jobs for unfamiliar callbacks or commands that recreate files.
  • Database content: check for injected scripts, redirects, and suspicious settings, not just altered PHP files.

Don’t delete every unfamiliar task or must-use plugin. Hosts and legitimate plugins use these too. Identify the owner and purpose first.

If that investigation is beyond your comfort zone, WordPress site cleaning should cover the cause and persistent access, not just the visible mess. Ask what was checked and what evidence supports the findings.


An older backup isn’t automatically clean

A backup from before the redirect appeared may already contain the backdoor. Symptoms can arrive later than the compromise.

Choose a restore point using the earliest evidence you have, then inspect it in an isolated environment with public access and outgoing email restricted. A usable WordPress backup needs both files and the database. Restoring only one can leave malicious content behind or create a mismatched site.

Check accounts, scheduled tasks, files, and software versions in that copy. Scan it too, but don’t treat a clean result as proof. No scanner catches everything.

For a shop selling replacement camera parts, rolling back the database can also remove recent orders. Plan how legitimate orders and customer changes will be recovered without copying infected tables straight back. If no backup can be verified, rebuilding from trusted software and reviewed content may be safer.


Replace compromised components, then close the gap

Deleting an injected line isn’t enough if neighbouring files have also changed. Replace WordPress core files with an official release, preserving and reviewing site-specific files separately. Reinstall plugins and themes from trusted sources rather than copying their old folders back.

Then patch the entry point. If a plugin has no safe supported version, remove it and find another way to provide that feature. Inactive doesn’t mean unreachable; some plugin files can still be requested directly.

Remove unused components. Check PHP support with your host and review file ownership and permissions against its recommendations. Making everything writable to fix an update error is a poor trade.

Custom themes and integrations need review too. Updating WordPress won’t repair an unsafe upload handler written specifically for your site.


Reset access from a clean environment

A new password won’t help much if malware can steal it again. Use a trusted device, and complete the credential reset once the site and hosting environment are clean. During containment, revoke known attacker access immediately rather than waiting.

Work through the access routes deliberately:

  1. Secure the email accounts used for password recovery, then reset hosting, SFTP or SSH, and WordPress credentials. Review SSH keys and other access tokens.
  2. Replace exposed database credentials, updating the WordPress configuration to match. Review connected services for exposed secrets.
  3. Regenerate WordPress authentication keys and salts to invalidate existing login cookies. Revoke unneeded application passwords separately.
  4. Enable two-factor authentication for WordPress administrators and supported hosting accounts.

Give each person their own account. Shared administrator logins make both access removal and investigation unnecessarily awkward.


Escalate anything outside WordPress

If files return after a controlled rebuild, involve your host. Ask it to investigate other sites under the same account, scheduled jobs, unexpected SSH keys, file ownership, and account-level access.

Another compromised site sharing writable directories may be the route back in. A WordPress plugin can’t settle that question.

Once the cause is addressed, establish file-change alerts, account reviews, update checks, and tested backups. Ongoing WordPress maintenance helps keep those jobs from slipping, but alerts still need someone to investigate them.

Start today by asking whoever handled the cleanup two questions: what let the attacker in, and what evidence shows their access was removed? “The scan is green” doesn’t answer either.