WordPress site keeps getting hacked? How to stop it coming back

If your WordPress site keeps getting hacked after a clean-up, something the clean-up missed is letting the attacker back in: often a hidden file, an old plugin, a reused password or a pirated theme. To stop it, close every one of those doors, then change all your passwords again once the site is clean.

Key takeaways

  • Write down what you’re seeing and when, and tell your host early.
  • Change every password linked to the site, not just your WordPress one, and log everyone out.
  • Take a copy of the site as it is now, even infected, before you start cleaning.
  • Replace WordPress, plugins and themes with fresh copies from trusted sources, and delete anything you don’t use.
  • Update everything, then change the passwords again once the site is clean.
  • Scan your own computer too. If your login details are being stolen from your laptop, the site will keep getting hacked.

This is a first-response guide, not a full clean-up manual. If your site takes payments or holds customer data, read “When to get help” first.

AdvertisementLooking after and fixing your website · Article topAdvertise here

First response: the first things to do

WordPress.org’s “My site was hacked” guide sets out a calm, step-by-step approach. Here it is in plain English, in a sensible order for a small business owner.

1. Stay calm and write things down

Note what made you think you’ve been hacked, when you noticed (with the date and time), and anything that changed recently, such as a new plugin, a theme edit or a new user. WordPress calls this the start of an incident report. Whether you fix the site yourself or hand it to someone else, this note saves a lot of back-and-forth.

Signs WordPress lists include: Google or Bing flagging your site; your host disabling it; visitors’ antivirus warning them away; new users you didn’t create; or the hack being visible when you open the site.

2. Contact your host

Tell your host early. WordPress points out that, especially on shared hosting, a hack may affect more than your site, and your host may already be acting on it. They can also confirm whether it’s really a hack or something else, such as an outage.

3. Change every password, and log everyone out

WordPress says to change all access points, which means:

  • your WordPress admin password (and every other admin user’s);
  • your hosting control panel login;
  • FTP or SFTP logins;
  • the database password (then update it in wp-config.php so the site can still connect).

Use long, unique passwords. A password manager makes this easier. The NCSC also advises turning on 2-step verification for important accounts such as your website and hosting, and changing any password you’ve reused across important accounts as soon as possible.

Then make sure nobody is still logged in. WordPress’s guide says to generate new secret keys from the WordPress key generator and paste them over the old ones in wp-config.php, which forces everyone to log in again.

If you’re locked out of your own admin account, our guide to fixing a WordPress login that isn’t working covers the usual ways back in.

4. Take a copy before you clean

This sounds backwards, but WordPress recommends taking one more snapshot of the site, even though it’s infected, before you start cleaning. If something goes badly wrong during the clean-up, you still have a copy to refer back to. Label it clearly so it never gets restored by mistake.

5. Scan the site, and your own computer

WordPress suggests two kinds of scan: a security plugin that checks your site from the inside, and an online scanner that checks it from the outside. Neither catches everything, but using both improves your chances. Choose plugins from the official WordPress.org plugin directory.

Then scan the computer you use to log in. WordPress warns that attacks often start on the site owner’s own laptop or desktop, where malware can capture the logins you type. Run a full antivirus scan. If you’re worried, try a second scanner too.

Why the hack keeps coming back

When a hack returns after a clean-up, check each of these.

A backdoor was left behind

A backdoor is a hidden file or snippet of code that lets an attacker get back in, even after you’ve changed your passwords. WordPress’s hacked-site guide explains why these often survive a clean-up: reinstalling WordPress from the dashboard tends to only overwrite existing files, and hacks often add new ones. So deleting the file you can see, or clicking “reinstall”, can leave the real problem in place.

WordPress’s advice is to replace the wp-admin and wp-includes folders by hand with fresh copies of the same version of WordPress, using FTP or SFTP. Then go carefully through wp-content, where your themes, plugins and uploads live. It singles out .htaccess as a file attackers often change, along with files such as index.php, header.php, footer.php and functions.php.

An old or unused plugin or theme

WordPress’s hardening guide says to keep plugins updated and delete any plugin you aren’t using. It also says older versions of WordPress aren’t maintained with security updates. Google’s web.dev guide says the same about software in general: check whether your versions have a known security problem, and keep them up to date.

If you’ve switched themes, an old one still sitting in your Themes list counts too. If you don’t use it, delete it. On the WordPress.org plugin page, check when a plugin was last updated before you trust it with your site.

For safe updating, our guide on how to look after a WordPress website yourself covers updates as part of a regular routine.

Reused or weak passwords

Google’s web.dev guide is clear: a password should be used for one thing only, because if you reuse it, one breach anywhere can open everything else. If your hosting password is the same one you use for an old shopping account, that account’s leak becomes your website’s problem.

The other trap is changing passwords only once, at the start. WordPress says to change them again after the site is clean. Otherwise, anyone who captured the new ones mid-clean-up still has them.

Nulled (pirated) themes and plugins

“Nulled” means a paid theme or plugin offered free on an unofficial site. WordPress’s hardening guide says not to get plugins or themes from untrusted sources, and to stick to the WordPress.org directory or well-known companies. A pirated download can come with hidden code already inside. If your site was built with one, replace it with a genuine copy from the developer or remove it, or the hack will keep coming back.

Your own computer

If malware on your laptop is capturing what you type, each new password goes straight to the attacker. This is why the scan in step 5 matters.

Shared hosting

WordPress’s hardening guide notes that on a shared server, a compromise on another site can sometimes affect yours, even if you’ve done everything right. Ask your host what they do to keep sites apart, and whether they’ve seen anything on the server.

Worked example (invented business): Sam runs a mobile hairdressing business in Cardiff. Spam links keep appearing on her site. Twice she deletes the strange files she can see and changes her WordPress password, and twice the spam returns within a fortnight. When she goes through the steps above, she finds three things: a “premium” theme she downloaded free years ago, an old contact-form plugin she’d stopped using, and an FTP password that matched her email password. She replaces WordPress’s core folders with fresh copies, deletes the old theme and plugin, changes every password (then changes them again once the site is clean), and turns on 2-step verification for her hosting account. Each of those was a way back in. Fixing only one would probably not have been enough.

After the clean-up

  • Update WordPress, your theme and your plugins to their latest versions.
  • Change the passwords again, all of them.
  • Turn off the built-in file editor. WordPress’s hardening guide says this editor is often the first tool an attacker uses after logging in. Adding define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php switches it off. Ask your host for help if you’ve never edited that file.
  • Check Google Search Console. If Google flagged your site, its Security issues report shows what it found. Fix every issue it lists, then click Request Review. Google says reviews can take from a few days to a few weeks. If you haven’t set up Search Console yet, our guide to checking whether your website is indexed shows how to get started.
  • Start proper backups, so next time you can restore a clean copy. Keep at least one away from your host. Our guide to restoring a WordPress backup and testing it before you need it shows how.

When to get help

Google’s own guidance says fixing a malware problem means being able to read and understand code, and possibly your server settings. If that’s beyond your comfort zone, get help.

Bring in your host or a website security professional if:

  • the hack has come back after you’ve followed the steps above;
  • your host has suspended the site;
  • the site takes payments, or holds customer or staff details. If a personal data breach is likely to risk people’s rights and freedoms, the ICO says you must report it without undue delay and, where feasible, within 72 hours of discovering it. Not every incident needs reporting; see the ICO’s guide for small organisations.
  • Google is showing a warning and you can’t find what it’s flagging;
  • you’re not confident editing files over FTP or SFTP.

Your host is the first call. They can see server logs and files you can’t. If you’re short of money, WordPress also points to its support forums, where volunteers help with hacked sites. When choosing a professional, ask what they’ll check to find how the attacker got in, not just what they’ll delete. A clean-up that doesn’t find the way in may not last.

If your site has a different problem, such as a white screen or a “critical error” message rather than spam or redirects, our guide to fixing “There has been a critical error on this website” is a better starting point.

What to do now

  1. Write down what you’ve seen and when, then contact your host.
  2. Change every password linked to the site, and force everyone to log out.
  3. Take a labelled copy of the site as it is, then scan the site and your own computer.
  4. Replace WordPress’s core folders, remove unused or pirated plugins and themes, and update the rest.
  5. Change all the passwords again, and ask for a Google review if your site was flagged.

FAQ

Why does my WordPress site keep getting hacked after I clean it?

Usually because the way in is still open: a hidden backdoor file, an old plugin or theme, a reused password, or malware on your own computer capturing your logins. Deleting the infected files you can see doesn’t close any of these.

Is reinstalling WordPress from the dashboard enough?

Often not. WordPress’s guide explains that dashboard reinstalls tend only to overwrite existing files, while hacks often add new ones. Replace the wp-admin and wp-includes folders by hand with the same WordPress version instead.

Should I just restore an old backup?

Only if you’re confident it was taken before the hack began, and even then you still need to change passwords and fix whatever let the attacker in. Otherwise the same thing can happen again.

Which passwords should I change?

All of them: WordPress admin users, hosting control panel, FTP or SFTP, and the database (updating wp-config.php to match). Change them again once the site is clean.

How long does a Google review take after a hack?

Google says a security review can take from a few days to a few weeks. Don’t resubmit while a request is still being reviewed.

Sources

All opened on 22 November 2026 (Europe/London).

  • WordPress.org, “FAQ My site was hacked”: https://wordpress.org/documentation/article/faq-my-site-was-hacked/
  • WordPress.org, “Hardening WordPress”: https://developer.wordpress.org/advanced-administration/security/hardening/
  • web.dev, “Identify the vulnerability”: https://web.dev/articles/identify-the-vulnerability
  • Google Search Console Help, “Security issues report”: https://support.google.com/webmasters/answer/9044101
  • NCSC, “Secure your important online accounts”: https://www.ncsc.gov.uk/collection/small-organisations-guide-to-cyber-security/secure-your-important-online-accounts
  • ICO, “72 hours – how to respond to a personal data breach”: https://ico.org.uk/for-organisations/advice-for-small-organisations/personal-data-breaches/72-hours-how-to-respond-to-a-personal-data-breach
  • ICO, “UK GDPR data breach reporting (DPA 2018)”: https://ico.org.uk/for-organisations/report-a-breach/personal-data-breach

The markdesigns Team

AdvertisementLooking after and fixing your website · Article bottomDesk kit worth a look: see our top picks