WordPress Site Hacked? A Calm, Step-by-Step Recovery Plan

Think you have a WordPress site hacked? This guide walks you through the first 30 minutes, the cleanup, and the habits that prevent a repeat.

WordPress site hacked: cracked shield over a website being repaired

Your first clue that you have a WordPress site hacked usually comes from someone else, such as a customer who says your shop sent them to a pill store. Inside the dashboard, everything often looks normal for days or weeks.

That delay is why the order of your next steps matters. This guide fixes the cause, not only the symptoms, so the problem does not come back next month.

How to tell if you have a WordPress site hacked

Not every odd behavior is an attack. A few signs are hard to explain any other way:

  • Your home page shows someone else’s message or an unfamiliar design.
  • Searching site:yourdomain.com in Google shows pages about pills, loans or gambling that you never wrote.
  • Visitors land on a different site, often only when they arrive from Google or from a phone.
  • Users > All Users lists an administrator you did not create.
  • Your hosting company suspends the account or sends a malware notice.

Browser warnings such as “Deceptive site ahead” are another strong signal. Sudden slowness counts too, because hidden scripts can use your server to send spam.

The first 30 minutes after your WordPress site is hacked

With a WordPress site hacked, stay calm and resist the urge to delete things. Files that look bad now may be the only proof of how the attacker got in.

  1. Take a full backup of the site as it is now, files and database. Store it off the server, because you will want this copy for investigation.
  2. Put the site in maintenance mode, or ask your host to take it offline. This protects visitors and stops further damage to your reputation.
  3. Change every password. That includes WordPress admins, hosting, FTP or SFTP, the database, and your email account.
  4. Replace the security keys and salts in wp-config.php. After that, all current logins end, which kicks out the attacker’s sessions.
  5. Review who has admin access. Remove people who no longer need it, and delete any account you do not recognize.

Your hosting dashboard and the WordPress.org support forums can help if you get stuck on a step.

Four recovery steps after a WordPress site hacked incident

Find out what happened

Now that the site is contained, look for the cause. A cleanup without a cause is only a pause before the next attack.

Scan files and the database

Run a malware scanner from a security plugin or from your host. Then check the database too. Attackers often hide spam links in posts, in widgets and in the options table.

Check recently modified files

Most hacks leave a trail of changed files. Ask your host for a list of files changed in the last 30 days, or use SSH to search by modified date. Pay close attention to wp-content/uploads, because that folder should hold images, not PHP files.

Review the access logs

Your server logs show which requests reached your site. Look for repeated login attempts on wp-login.php, strange POST requests, and calls to files you do not recognize. You can often pin down the exact minute the attacker came in.

Identify how your WordPress site got hacked

The way in is usually ordinary. Think of an outdated plugin, a weak or reused password, or a nulled (pirated) theme or plugin. Nulled software often ships with a built-in backdoor, so it deserves extra suspicion.

A senior developer follows a set order when taking over a troubled site. This article on a senior developer’s first 48 hours on security shows what that looks like in practice.

Clean or restore the hacked WordPress site

You have two main paths when you have a WordPress site hacked by malware. Each one works only if you also close the entry point.

Restore a known-good backup

This is faster when you have a clean backup from before the hack. You must be sure the backup is truly clean, though, because a backup made after the attack brings the malware back. After the restore, update everything and change the passwords again.

Manual cleanup

If no clean backup exists, you must clean by hand.

First, reinstall WordPress core files and every plugin and theme from fresh downloads. Then remove unknown files, unknown admin users and injected code in the database. Finally, check the .htaccess file and wp-config.php for added lines.

Manual work takes patience, because one missed backdoor lets the attacker return. Many owners hand this step to a specialist for that reason.

Why the entry point matters either way

If the weak plugin is still installed, the same attacker or a bot will find it again. Restoring a backup does not fix an old plugin. Updating or removing the weak part is what ends the problem.

After the cleanup

A clean site is not a finished job. These steps matter as much as the cleanup itself.

  • Update WordPress core, every plugin and every theme.
  • Remove unused plugins and themes, because inactive code can still be attacked.
  • Review your hosting setup. On shared hosting, one infected site can spread to others in the same account, so ask whether sites are isolated from each other.
  • Scan again after a few days to confirm nothing came back.
  • If Google flagged you, open Google Search Console, go to Security issues, and request a review once the site is clean.

Google reviews can take several days, so a short wait for the warning to clear is normal.

Prevent a second WordPress site hacked incident

Prevention is mostly routine work, and a WordPress site hacked once is a likely target again. These habits stop most attacks.

Set an update rhythm

Check for updates at least weekly, and apply security fixes quickly. Test larger updates on a staging copy first. Delays carry a real price, as shown in this piece on the business cost of delaying security patches.

The PHP version matters too. PHP 8.2 reaches end of life on 31 December 2026. After that date it will stop getting security fixes, so plan your move to a newer version now.

Use least-privilege users

Give each person only the access they need. A writer needs the Editor or Author role, not Administrator. Turn on two-factor login for every admin account.

Keep offsite backups

Store daily backups away from your web server, because a backup that lives on the same server can be hit by the same attack. Test a restore now and then, so you know the backup works.

Many owners prefer to hand this routine to a provider. For example, monthly security maintenance covers updates, backups and monitoring on a schedule.

When to bring in a professional

Call in help if you cannot find the entry point, if the malware keeps coming back, or if you handle customer data or payments. Time matters in those cases, and a mistake can be costly.

A fixed scope WordPress Rescue service covers containment, cleanup, and closing the hole that let the attacker in. It gives you one clear plan instead of a pile of guesses.

Frequently asked questions

What should I do first if I find my WordPress site hacked?

Do not delete anything yet. First, take a full backup of the current state, then put the site in maintenance mode.

Change all passwords and your security keys. After that, scan the files and database to find what the attacker changed.

Can I just restore a backup to fix a hack?

Sometimes, but only if the backup predates the attack. A restore also does not close the hole that let the attacker in.

Update or remove the weak plugin or theme right after restoring, and change every password again. Then scan the site to confirm it is clean.

How long does Google take to remove a hacked warning?

After the site is clean, request a review in Google Search Console under Security issues. Reviews often finish within a few days, though some take longer.

The warning will return if the infection is still on the site, so scan again first.

Working through a similar problem?

Share the context and the part that needs to work better. I can help define the next useful step.

Muzammil HussainUpwork / Top RatedMuzammil HussainWordPress & WooCommerce engineering.100%Job Success86Jobs2.6KHoursWork with me on UpworkProfile figures checked 2026-10-26. Opens in a new tab.

Written by Muzammil, independent WordPress and WooCommerce engineer. Explore the services or discuss your project.