My WordPress site was hacked: what to do, step by step

Security21 Nov 2026·7 min read·By Daniyal Hassan·Updated 21 Nov 2026
Illustration for: My WordPress site was hacked: what to do, step by step

Finding out your site has been hacked is stressful, but a calm, methodical response limits the damage. Here is the order I work in.

Quick answer

If your WordPress site is hacked: take a backup of its current state, put the site in maintenance mode, reset every password (WordPress, hosting, database, FTP), scan and remove malware from files and database, update everything, find and fix the entry point, then add monitoring and backups. If you are not confident doing this, hire a developer rather than deleting files at random.

What are the signs of a hacked WordPress site?

  • Visitors are redirected to spam, gambling or unfamiliar sites.
  • Google shows “This site may be hacked” or a red warning page.
  • Your hosting provider suspends the account for malware.
  • Unknown admin users, plugins or files appear.
  • Your site sends spam email or shows strange pages in search results.
  • Sudden traffic drops or unusual server load.

What should I do in the first hour?

  1. Take a backup of the current state. Even infected, it is evidence and a safety net.
  2. Put the site in maintenance mode so visitors are not exposed.
  3. Reset every credential: WordPress admins, hosting control panel, database, FTP/SSH and any email tied to the site. Use strong, unique passwords.
  4. Remove unknown admin users and review the rest.
  5. Scan files and the database for malware, including hidden backdoors.
  6. Update WordPress core, plugins and themes from trusted sources, and delete anything unused.
  7. Check scheduled tasks, .htaccess and wp-config.php for injected code.

A word of caution: deleting only the files you can see rarely works, because attackers plant backdoors that reinfect the site.

Curious how healthy your own site is?Take the free 2-minute self-check. Instant score, no email needed.
Take the self-check

How do I find out how the hacker got in?

Cleaning without closing the entry point means you will be hacked again. Common causes are an outdated or abandoned plugin or theme, a weak or reused password, a compromised hosting account, or a nulled (pirated) plugin. Server logs, file modification dates and the timeline of the infection usually point to the culprit, though logs are not always complete.

Should I restore from a backup?

Only after checking it. A backup taken after the infection will bring the malware back, and one taken before still has the vulnerability that let attackers in. Restore, then patch and harden in the same step.

How do I prevent my site being hacked again?

  • Keep core, plugins and themes updated, and delete what you do not use.
  • Use strong unique passwords and two-factor authentication for admins.
  • Disable file editing in the dashboard and limit login attempts.
  • Keep tested off-site backups, not just on the same server.
  • Monitor uptime and file changes so you hear about problems early.
  • Avoid nulled plugins and themes entirely.

These are all included in my monthly partner plans.

When should I hire a professional?

Hire help if the site is business-critical, if the infection keeps coming back, if your host has suspended the account or if you are not sure what you are deleting. My hacked site recovery service covers cleanup, root cause, hardening and monitoring, and I reply within 24 hours.

Frequently asked questions

Can a hacked WordPress site be fully recovered?

In almost all cases, yes. The key is removing every backdoor, closing the entry point and hardening the site, not just deleting visible malware.

Will Google penalize my site if it was hacked?

Google may flag a hacked site with a warning and drop affected pages. After cleanup you can request a review, and rankings usually recover once the warning is removed.

How long does it take to clean a hacked WordPress site?

It depends on the size of the site and how deep the infection goes. Containment is quick, and a full cleanup, root-cause fix and hardening takes longer.

DH
Daniyal HassanSenior WordPress & full-stack developer in Lahore, Pakistan. I build fast, secure sites and custom plugins for clients worldwide.

Want this done for you?

Send me your site and get a free audit and a fixed quote within 24 hours.

See pricingFree audit →
Before you go

Not ready to hire? Check your site for free.

Two minutes, ten questions, an instant score and a list of what to fix first. No email, no sales call.

Take the free self-check ↗