Deskhand
Guide

WordPress site hacked? What to do, step by step

The signs of a hacked WordPress site and a calm, ordered recovery plan: document, back up, scan, clean, close the hole and ask Google to review.

By the Deskhand team · Published 15 November 2026 · Updated 15 November 2026 · 7 min read

The short answer

If you think your WordPress site has been hacked: stay calm and write down what you see, back up the site as it is, scan it, reset every password and log everyone out, reinstall clean WordPress core files and check .htaccess, index.php, header.php, footer.php and your theme's functions file, update everything, change the passwords again, and if Google flagged the site, fix every issue and request a review in Search Console. Then work out how the attacker got in, so it cannot happen again.

Finding out your website has been hacked is stressful, especially when it is how customers find you. The good news is that a hacked WordPress site can almost always be recovered. This guide follows the order recommended in WordPress.org's own "My site was hacked" documentation and Google's Search Console help, with plain explanations of each step.

How do I know if my WordPress site has been hacked?

WordPress.org lists clear indicators of compromise, including:

  • The site is blacklisted by Google, Bing or other search engines.
  • Your host has disabled the site.
  • The site has been flagged for distributing malware.
  • Visitors say their antivirus flags your site.
  • You are told your site is being used to attack other sites.
  • Things happened that you did not authorise, such as new admin users.
  • You can see the hack when you open the site in a browser.

Other common signs: pages you never created appearing in Google, redirects to unrelated sites (often only on phones or only for visitors arriving from search), your emails landing in spam because your server was used to send spam, and a warning in Google Search Console's Security issues report.

What should I do first?

1. Stay calm and document what you see

WordPress.org's first actionable step is documentation: what makes you think you were hacked, when you noticed it (with the time zone), and what changed recently, such as a new plugin, a theme change or a widget edit. Note your hosting details too. This becomes your incident report, whether you fix it yourself or hire help.

2. Back up the site as it is

Before cleaning, take a full backup of files and database, even though it is infected. If something goes wrong during clean-up, you can return to this point, and it preserves evidence of what happened. Ask your host whether they have clean backups from before the hack.

3. Scan the site and your own computer

WordPress.org recommends combining application scanners (security plugins such as Wordfence, Sucuri, Quttera or GOTMLS) with remote scanners that check the site from outside (such as VirusTotal and Sitecheck). It also recommends a full antivirus scan of the computers you use to manage the site, because infections often start on a local machine that steals login details.

4. Talk to your host

On shared hosting, a hack may affect more than your site, and your host may already be acting. Ask whether your server's IP has been blacklisted for spam email; WordPress.org notes email blacklisting is an increasingly common side effect.

How do I lock the attacker out?

  1. Reset every password for every user: WordPress admin, hosting control panel, FTP or SFTP, and the database. WordPress.org stresses that this means all access points and all users.
  2. Log everyone out by replacing the secret keys in wp-config.php with new ones from the WordPress key generator. This ends any session the attacker still has.
  3. Remove unknown admin users.
  4. Turn on two-factor authentication for admin logins.
If you cannot log into WordPress at all, WordPress.org explains how to regain access through your host's database tool (phpMyAdmin or Adminer): update your user's email address in the users table, then use "Lost your password?" on the login screen.

How do I remove the hack from WordPress?

This is the hardest step, and the approach depends on the symptoms. WordPress.org's guidance:

  • Reinstall WordPress core. The /wp-admin and /wp-includes folders can be replaced with fresh copies of your WordPress version with little risk to your content.
  • Work carefully through /wp-content, which holds your themes and plugins. Replace plugins and themes with fresh copies from their official source, and delete any you do not use.
  • Check .htaccess at the root of your site. It is one of the files most often modified by attackers, whatever the infection.
  • Check the files that affect every page: index.php, header.php, footer.php and your theme's functions file. If modified, they affect every request.
  • Look for files that do not belong, especially PHP files inside the uploads folder, where only images and documents should live.

If you use version control, comparing your files against the official WordPress repository shows exactly what changed. If the clean-up is beyond you, WordPress.org points to its community forums, and professional clean-up services exist.

What should I do after the site is clean?

  1. Update everything. WordPress core, themes and plugins. WordPress.org notes older versions are more prone to hacks.
  2. Change the passwords again. If you only changed them when you discovered the hack, the attacker may have captured the new ones. Use long, unique passwords, and consider changing the database user and password too.
  3. Find out how they got in. A weak password, a vulnerable plugin, or an infected computer. Cleaning without closing the hole usually means being hacked again.
  4. Harden the site. Keep backups running, remove unused plugins and themes, and keep two-factor authentication on.

How do I get my site off Google's blacklist?

If Google has found a problem, pages may show a warning in search results or a full-page browser warning. Google's Search Console help explains the process:

  1. Open the Security issues report in Search Console. It lists issues such as hacked content (malware, code injection, content injection, URL injection), malware and unwanted software, and deceptive pages, with sample affected URLs.
  2. Fix every issue across the whole site. Google says fixing only some pages will not earn a partial return to search results.
  3. Test your fixes.
  4. Select Request Review and describe the exact issue, the steps you took and the outcome.
  5. Wait. Google says most reviews take several days or weeks. Do not resubmit before you get a decision.

WordPress.org also recommends registering your site with the webmaster consoles of Google, Bing and others in advance, so you hear about problems early.

How do I stop it happening again?

  • Keep WordPress, plugins and themes updated, and remove what you do not use.
  • Use unique, long passwords and two-factor authentication for every admin.
  • Keep regular, tested backups of files and database, stored away from the server.
  • Check the site regularly: unknown files, new admin users, changed core files, missing security headers and pages that have broken.
  • Watch Google Search Console for security warnings.

How do WordPress sites usually get hacked?

Knowing the usual routes in helps you close the right door. The common ones:

  • Outdated software. WordPress.org notes older versions are more prone to hacks. The same applies to plugins and themes, which are a frequent entry point when not updated.
  • Weak or reused passwords on WordPress admin, FTP, the hosting control panel or the database.
  • An infected computer. WordPress.org warns that attacks often begin on the site owner's own machine, where malware captures login details.
  • Unused plugins and themes left installed, which still contain code an attacker can use.
  • Files left in public, such as old backups or copies of configuration files that anyone can download.

Where Deskhand fits

Deskhand's website agent, Sam, does the regular checking for you. Every day he reads your website's own files for signs of a break-in such as hidden webshells, injected code or a file that quietly adds an admin, checks the padlock and security headers, looks for backups and settings files left where anyone could download them, and tests that pages and contact forms still work. Safe fixes are made only after a backup and can be undone; anything with judgement in it waits for a person. Sam does not replace a full incident clean-up, but he catches problems early. See website security.

Questions

What are the signs a WordPress site is hacked?

Search engine or antivirus warnings, your host disabling the site, new admin users you did not create, redirects to unrelated sites, spam pages in Google, or changes visible when you open the site.

Should I delete my hacked WordPress site and start again?

Usually not. WordPress.org suggests reinstalling core files (wp-admin and wp-includes) and carefully replacing themes and plugins, while keeping your content and database after checking them.

How long does Google take to remove a hacked site warning?

After you fix every issue and request a review in Search Console, Google says most reviews take several days or weeks.

Why change passwords twice?

If the site is still infected when you change passwords, the attacker may capture the new ones. Change them again once the site is clean.

Which files do hackers usually change in WordPress?

WordPress.org highlights .htaccess, index.php, header.php, footer.php and the theme's functions file, because changes there affect every page.

Sources

  1. WordPress.org Documentation, FAQ My site was hacked.
  2. Google Search Console Help, Security issues report.
  3. Google Search Central Blog, #NoHacked: Fixing the injected gibberish URL hack.
  4. VirusTotal, URL and file scanner.

Answer every lead in minutes, not hours.

The live demo runs on sample data, so you can open every screen first. No sign-up needed.