Security Troubleshooting

What to Do If Your WordPress Website Has Been Hacked

A hacked site feels like an emergency, and it is one, but rushing makes it worse. This is the calm, ordered process: contain, investigate, clean, harden and recover your search visibility.

Share this guide

A customer rings to say your website redirected them to a casino site. Or Google shows “This site may be hacked” under your listing. Or you search your own business and find pages of Japanese product spam on your domain. Your stomach drops. The good news: WordPress sites can be cleaned and recovered, and most hacks come through a small number of well-known routes.

Quick answer

Don’t panic and don’t just delete files. Change all passwords, put the site into maintenance mode if it’s harming visitors, and contact your host. Take a copy of the hacked site for investigation, then restore a clean backup or clean the files and database. Update everything, find and close the way in, then check Search Console’s Security issues report and request a review once the site is clean.

This guide sets out the full process in order, the signs to look for, how attackers usually get in, how to recover your Google listing, and how to stop it happening again. It draws on the WordPress.org security documentation and Google’s Search Console guidance, linked at the end.

Signs your site has been hacked

SignWhat it often means
Visitors redirected to spam, adult or scam sitesInjected redirect code, often only for mobile or for visitors from Google
“This site may be hacked” in Google resultsGoogle detected hacked content
Browser warning such as “Deceptive site ahead”Malware or phishing detected
Unfamiliar pages in a site: searchSpam pages injected into your domain
New admin users you didn’t createSomeone has dashboard access; see spotting suspicious admin users
Host suspends the account or reports high usageYour server may be sending spam or attacking others
Search Console email about security issuesGoogle found a problem and lists examples

Step by step: what to do

Step 1: Contain the damage

  • Change passwords for WordPress admins, hosting, SFTP, the database and your email account. Do it from a device you trust.
  • If visitors are being redirected or served malware, put the site into maintenance mode or ask your host to take it offline temporarily.
  • Contact your host. Many have security teams, logs and clean backups, and they need to know if their server was used for spam.

Step 2: Take a copy before you change anything

Download the files and database as they are now. It feels backwards, but you need it to work out how the attacker got in and what they changed. Store it separately and don’t restore from it.

Step 3: Restore a clean backup, or clean the site

If you have a backup from before the hack, restoring it is usually fastest. Our guide to restoring a WordPress backup explains how. Be careful: you need to know roughly when the hack happened, because a backup taken after it will reinstall the problem.

If there’s no clean backup, the site needs cleaning. The WordPress.org hacked-site FAQ recommends replacing WordPress core files with fresh copies, reinstalling plugins and themes from their official sources, and checking the database and uploads folder for injected code. Our guide on finding malware on a website covers what to look for.

Step 4: Update everything and remove what you don’t use

Update WordPress, every plugin and every theme. Delete inactive plugins and themes entirely; see removing unused themes and plugins safely. Replace anything abandoned by its developer, and never use “nulled” (pirated) premium plugins, which are a known source of malware.

Step 5: Find and close the way in

Cleaning without closing the hole means being hacked again within weeks. The most common routes are:

Entry pointHow to close it
Outdated plugin or theme with a known vulnerabilityUpdate or remove it; check the plugin’s changelog for security fixes
Weak or reused passwordStrong unique passwords and two-factor authentication
Nulled premium plugin or themeDelete it and buy the genuine version, or replace it
Compromised hosting account or neighbouring siteTalk to your host; isolate sites from each other
Too many admin accountsRemove old users; give people the lowest role they need

Step 6: Harden the site

Follow the WordPress hardening guide: correct file permissions, disabling file editing in the dashboard, limiting login attempts and keeping regular off-site backups. A website firewall adds another layer. Our guide to protecting WordPress from common security problems brings it together.

Recovering your Google listing

Google’s spam policies cover hacked content, and Google may show warnings or remove affected pages to protect searchers. Once the site is clean:

  1. Open the Security issues reportIn Search Console, go to Security & Manual Actions, Security issues. It lists the problem type and example URLs.
  2. Check every example URLMake sure each one is now clean, returns 404 or 410 if it was a spam page, or shows your real content.
  3. Request a reviewDescribe what you fixed and how. Google’s Security issues help explains the review process.
  4. Remove spam pages from your sitemapAnd check for sitemaps the attacker may have added.
  5. Check for unknown Search Console ownersAttackers sometimes verify themselves as owners. Remove any you don’t recognise under Settings, Users and permissions.
  6. MonitorWatch the Page indexing report and a site: search as spam URLs drop out over the following weeks.

Your obligations

If the hack exposed personal data, such as customer details from forms or orders, you may have obligations under GDPR, including notifying the Data Protection Commission within 72 hours in many cases. Get advice early. Ireland’s National Cyber Security Centre also publishes guidance and accepts incident reports.

A worked example

This is an illustration, not a specific client. A Dublin café’s site starts redirecting mobile visitors from Google to a fake prize page. The owner, browsing on a laptop while logged in, sees nothing wrong until a customer complains. Search Console shows a hacked content warning with example URLs.

The host restores a backup from two weeks earlier, but the redirects return within days, because the entry point, an outdated slider plugin, is still there. Second time round, the café removes the plugin, updates everything, deletes an unknown admin account, adds two-factor login and requests a Google review. The warning is lifted and the site stays clean.

Mistakes to avoid

How to confirm the site is clean

  • Search Console’s Security issues report shows no issues after review.
  • A site:yourdomain.ie search shows only your real pages, over time.
  • Testing on mobile, arriving from Google in a private window, shows no redirects.
  • Only known users have admin access, and file changes stop appearing unexpectedly.

If you’d like help, our website development team can rebuild or secure a WordPress site, and a technical SEO review checks search visibility after a clean-up.

Frequently asked questions

How do I know if my WordPress site is hacked?

Look for redirects, Google warnings, strange pages in a site: search, unknown admin users or a host notice.

Will a hack hurt my Google rankings?

It can. Google may show warnings or remove affected pages until the site is cleaned and reviewed.

How long does Google take to remove the warning?

After a review request, Google says reviews can take from days to a few weeks, depending on the issue.

Should I just restore a backup?

Only a backup from before the hack, and only after you’ve found and closed the entry point.

Do security plugins prevent hacks?

They help, but updates, strong passwords and removing unused plugins matter more.

Do I need to report the hack?

If personal data was exposed, GDPR may require you to notify the Data Protection Commission. Get advice.

Related reading: why a site shows a security warning after installing SSL, updating WordPress safely, how a DDoS attack affects a website, a website suddenly disappearing from Google and our technical SEO guide.

Sources and further reading

  1. Security issues reportSearch Console Help: hacked content, malware and requesting a review.
  2. FAQ: My site was hackedWordPress Developer Resources.
  3. Hardening WordPressWordPress Developer Resources.
  4. Spam policies: hacked contentGoogle Search Central.
  5. National Cyber Security Centre (Ireland)Irish national guidance and incident reporting.

Last updated 25 November 2026. Google changes its tools and reports regularly, so check the official sources above if something on screen looks different. This guide is general information, not advice for your specific website.

Found this useful? Share it