Website repairs

My WordPress site has been hacked: what to do next

Roughly 4 minute read by Les

Finding out your website has been hacked is horrible. Customers might be seeing spam, being sent to dodgy sites or getting a big red warning from Google before they even reach you. The good news is that a hacked WordPress site can almost always be cleaned up and secured. This guide walks you through what to do, in order, so you don't make it worse.

Signs your WordPress site has been hacked

Some hacks are obvious. Others hide from you on purpose and only show up for visitors or search engines. Look out for:

  • Visitors being redirected to spam, gambling or pharmacy sites, sometimes only on phones or only when they arrive from Google.
  • Strange pages or links in Google results for your site, often in another language.
  • A "This site may be hacked" or "Deceptive site ahead" warning in Google or your browser.
  • Admin users you don't recognise, or being locked out of your own login.
  • Your hosting company suspending the site or emailing you about malware or spam being sent.
  • The site suddenly running very slowly or showing errors.

A quick check: search Google for site:yourdomain.co.uk and scroll through the results. Pages you didn't create are a strong sign something's wrong.

Step 1: Don't panic, and don't start deleting

The natural reaction is to start deleting plugins or reinstalling things. Hold off. Deleting files at random can remove the evidence of how the hackers got in, which means they'll simply come back, and it can break parts of the site that were fine.

Step 2: Take a backup of the site as it is now

Before anything changes, make a full copy of the files and the database, hacked or not. It gives whoever cleans the site something to investigate and a way back if anything goes wrong during the clean-up. Most hosting control panels have a backup tool, or your host can do it for you.

Step 3: Change every password

Change the passwords for everything connected to the site, ideally from a computer you trust:

  • Every WordPress admin account, and remove any admin users you don't recognise.
  • Your hosting control panel.
  • FTP or SFTP accounts.
  • The database password, which also needs updating in the wp-config.php file.
  • The email account linked to your WordPress admin and hosting.

Use long, unique passwords and turn on two-factor authentication wherever it's offered.

Step 4: Tell your hosting company

Your host may already know, and they can often tell you which files have changed or where the attack came from. If you're on shared hosting, they'll want to make sure it hasn't spread to other accounts. Some hosts offer a malware scan, which is a useful starting point, though a scan alone rarely finds everything.

Step 5: Find out how they got in

This is the step most quick fixes skip, and it's why so many sites get hacked again a week later. The usual way in is:

  • An out-of-date plugin or theme with a known security hole.
  • A "nulled" or pirated premium plugin or theme with malware built in.
  • A weak or reused password.
  • An old copy of the site, or an unused plugin, left sitting on the server.
  • An old version of PHP that no longer gets security fixes.

Until that hole is found and closed, any clean-up is only temporary.

Step 6: Clean the site properly

A proper clean means replacing WordPress core files, plugins and themes with fresh copies from their official sources, then checking everything that can't be replaced, like your uploads folder and the database, for injected code, spam links and hidden admin users. It also means resetting WordPress's security keys so any stolen login sessions stop working.

This is fiddly work, and malware is often written to hide in places that look normal. If you're not comfortable reading PHP and database tables, it's the point to get help. I do hacked WordPress clean-ups and malware removal, including on sites someone else built.

Step 7: Clear Google's warning

If Google has flagged your site, the warning won't go away on its own. Once the site is clean, open Google Search Console, check the Security Issues report and request a review. If you don't have Search Console set up, it's free and worth doing anyway. Also check whether any spam pages are still showing in search results, and remove them.

How to stop it happening again

Most hacks are preventable with regular, boring maintenance:

  • Keep WordPress, plugins, themes and PHP up to date, taking a backup first.
  • Delete plugins and themes you don't use.
  • Only install plugins from trusted sources, and never pirated ones.
  • Use strong passwords and two-factor authentication for every admin.
  • Keep regular backups stored away from the website itself.
  • Have someone keep an eye on the site, so problems get caught early.

If you'd rather not think about any of that, my hosting and care plans keep your site updated, backed up and monitored for you.

Should you move off WordPress?

Not necessarily. A well-maintained WordPress site can be perfectly safe. But if your site keeps getting hacked, is slow, or nobody's looking after it, it's worth asking whether a different setup would suit you better. I've compared the two in WordPress vs Next.js for small businesses.

If your site has been hacked and you're in Torquay, Paignton, Brixham or anywhere in Devon, get in touch. A hacked site goes to the top of my list, and I'll tell you honestly what it needs.