Signs a WordPress site was hacked

Hacks rarely announce themselves. Look for these, and check from more than one device, because a lot of malware hides from logged-in administrators:

  • Redirects to spam, gambling or scam pages, often only for visitors who arrive from Google or on a phone.
  • A warning in Google’s results (“This site may be hacked”) or a red browser page.
  • Spam pages under the domain. Search site:example.com and look for pages in another language or about products the client never sold.
  • Users nobody created, especially administrators, or the client’s own login suddenly failing.
  • Plugins nobody installed. Some malware hides its plugin from the Plugins screen, so compare the folders in wp-content/plugins/ with the list in wp-admin.
  • The host suspends the account for malware or for sending spam email.
  • Customers report card fraud after buying on a shop: a sign of a card skimmer on checkout.

WordPress.org keeps a short FAQ for hacked sites worth sending to a client who asks what happened.

Step 1: keep a copy before you change anything

Cleaning destroys evidence. Before you delete a single file, copy the site as it is:

wp db export ../hacked-2026-11-24.sql
tar -czf ../hacked-files-2026-11-24.tar.gz --exclude=wp-content/cache .

The ../ writes both copies one folder above WordPress, which on most hosts is outside the web folder, so nobody can download them from the site. Or ask the host for a snapshot. Move the copy off the server when you can. You will use it to work out how they got in and what they changed.

Step 2: lock the attackers out

Assume every password and session on the site is known.

  1. Put up a maintenance page if the site is redirecting visitors or serving malware, so customers stop being harmed while you work.
  2. Change the passwords that reach the files first: the hosting account, SFTP and SSH users, and the database user (then update DB_PASSWORD in wp-config.php).
  3. Sign everyone out of WordPress by changing the security keys in wp-config.php:
wp config shuffle-salts

Without WP-CLI, replace the eight keys and salts by hand with fresh ones from WordPress.org’s key generator. Everyone, the attacker included, has to log in again.

  1. Review administrators:
wp user list --role=administrator --fields=ID,user_login,user_email,user_registered

Delete accounts nobody recognizes (assign their posts to a real user), and reset the real ones’ passwords.

  1. Revoke application passwords under Users, Profile, Application Passwords for each administrator. They let scripts in without the normal login.

Step 3: find out how they got in

If you skip this, the same hole lets them back in after you clean up. The usual ways in:

  • A plugin or theme with a known hole. Compare every installed version with a vulnerability database. Check holes that need no login first.
  • A stolen or reused password, often an administrator without two-step login.
  • A nulled (pirated) premium plugin, which often ships with a backdoor.
  • Another site in the same hosting account. One infected site can write into its neighbors’ folders.
  • Leaked FTP or hosting credentials, or a compromised computer of someone with access.

Clues: the oldest changed file (sort the copy’s files by date), the host’s access logs around that time (look for POST requests to unusual files or to admin-ajax.php with odd actions), and the registration time of any fake administrator.

Step 4: clean the site

Replace everything you can with clean copies, then hunt what cannot be replaced. In short:

  • WordPress core: wp core verify-checksums, then reinstall core files with wp core download --force --skip-content.
  • Plugins and themes: reinstall each from WordPress.org or the vendor at the same version; wp plugin verify-checksums --all checks the WordPress.org ones.
  • Uploads: WordPress keeps media there, not code. Any .php file in wp-content/uploads/ needs a reason to exist.
  • Must-use plugins, drop-ins, wp-config.php, .htaccess and .user.ini: code that runs on every request and hides from the plugin list.
  • The database: scripts injected into options and posts, hidden users, and scheduled tasks that put the malware back.

Our step-by-step guide to removing malware from WordPress covers each of these with the commands.

Step 5: close the hole and harden the site

  • Update everything, and delete plugins and themes that are switched off: an inactive plugin can still be attacked.
  • Replace any plugin that is abandoned or has a hole with no fix.
  • Turn on two-step login for every administrator and shop manager.
  • Limit failed logins and refuse breached passwords.
  • Stop code changes from wp-admin: define( 'DISALLOW_FILE_EDIT', true ); in wp-config.php turns off the plugin and theme editor; blocking PHP in the uploads folder stops code planted there from running.
  • Put a firewall in front of known holes for the time between a hole being published and the fix reaching the site.

Our WordPress security guide for agencies explains each layer.

Step 6: get the warnings removed

  • Google: in Search Console, open Security issues, fix every sample URL it lists, then click Request review and say what you removed and how you closed the hole. Google’s page on malware and unwanted software explains what it looks for. Malware reviews take days; spam reviews can take weeks.
  • The host: if it suspended the account, send it what you cleaned and fixed.
  • Email blocklists: if the site sent spam, check the domain’s mail reputation and ask the mail provider for delisting.

Should you just restore a backup?

A clean backup is a fast way back, but it is not a fix on its own. Backdoors are often planted days or weeks before the visible attack, so the “clean” backup may hold them too, and the hole the attacker used is still there. On a shop, restoring also rolls back every order since the backup. If you restore, still do steps 2, 3 and 5, and scan the restored site.

How to explain it to the client

Tell the client early, plainly, and without blame. Clients forgive a hack; they do not forgive hearing about it from their customers. Cover:

  1. What happened and when you found it (“On 24 November visitors from Google were sent to a spam site”).
  2. What you did to stop it, and that it is stopped.
  3. How they got in and what you changed so it cannot happen the same way.
  4. Whether customer data could have been reached. If it could, for example card details on checkout, tell the client to get advice on their obligations; do not guess on their behalf.
  5. What it means for the care plan going forward.

How Keptstone handles it

Keptstone gives agencies malware scanning and repair tools, not a done-for-you malware removal service, and it does not run backups (it records the host’s).

When a site is under attack, the emergency lockdown on the site’s Protection card logs everyone out, gives every administrator a new random password (each sent WordPress’s reset email) and locks code changes from wp-admin. The malware scanner checks core, plugins, themes, uploads, wp-config.php, server settings and the database, and its findings come with repairs: restore a changed WordPress file from WordPress.org, reinstall a changed plugin (with a restore point first), or quarantine an unknown file, which can be put back. Database and server findings show the code to fix by hand.

To keep it from happening: two-step login for client admins, hardening checked from outside, a code lock and an administrator guard that undoes administrator accounts made any other way than by a signed-in administrator, WP-CLI or Keptstone. Those are in the Care plan, $2 a site a month. The firewall that loads before WordPress, patches for holes found on your sites, malware scans and the file watch are in Care + Protect + Speed, $4 a site a month.

Questions

How do I know if my WordPress site was hacked?

Common signs are redirects to spam or scam pages (often only for visitors from Google or on phones), a warning in Google's results or the browser, spam pages under your domain in a site: search, administrators nobody created, and a host suspending the account. Search Console's Security issues report shows what Google found.

Can I fix a hacked WordPress site myself?

Often, yes, if you have SFTP or SSH access and work methodically: replace what can be replaced with clean copies, hunt what cannot, and close the hole. Bring in a specialist when the infection keeps coming back, when card details may have been taken, or when you cannot find how they got in.

Will restoring a backup fix a hacked site?

Only partly. A backup from before the hack removes the visible damage, but the hole they used is still there, and backdoors are often planted days before anything shows. Restore, then still update everything, change every password and check for leftover files.

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

After you fix the site and request a review in Search Console's Security issues report, Google says malware reviews take a few days and reviews for spam hacks can take several weeks. Ask only when everything listed is fixed, because a failed review slows the next one.