WordPress Website Hacked: What to Do in the First Hour

A first-hour plan for a hacked or redirecting WordPress site: take it offline, secure your logins, clean or restore it, then ask Google for a review.

Published 1 December 2026

If your WordPress website is hacked, ask your host to take it offline and save a copy for checking. Use a clean device to change your passwords and remove access you do not recognise. Then restore a backup from before the hack, or clean the site. Fix how the hacker got in before you open the site again.

Signs to look for

  • Visitors are sent to betting, prize or other strange pages. Some hacks only affect phones or people coming from Google, so your own visit may look normal.
  • A Google search for site:yourdomain.com shows pages you did not make.
  • There are unknown administrators, changed files, or a warning from your host or browser.
  • Google Search Console lists a problem under Security issues.

Do not keep opening strange pages. Use Search Console's URL Inspection tool to see what Google sees. Also check your domain account and use a DNS checker, because a changed DNS record can send people to another site.

Your first hour

Keep this order, even if a step takes longer.

0 to 15 minutes: save details and go offline

  1. Take screenshots. Note the time, page address, device and recent changes.
  2. Ask your host to take the site offline with a 503 page that is separate from the hacked files. A maintenance plugin on the hacked site is not enough.
  3. Ask for a private copy of the files, database and server logs. Label it infected and never restore it to the live site.

Send this to your host:

My WordPress site may be hacked: yourdomain.com
First noticed: [date, time and what happened]

Please:
1. Take it offline with a 503 page outside the hacked files.
2. Save a private copy of the files and database.
3. Keep the access, login and error logs.
4. Check if other sites in my account are affected.
5. Tell me the dates of your available backups.

15 to 45 minutes: secure your accounts

Backup first: save a private copy of wp-config.php before steps 3 and 5.

  1. Scan the computer you use for the site. Do the next steps on a clean device.
  2. Change the password of the email used for resets, then hosting, domain and SFTP or FTP. Turn on two-step login where you can. Note and remove any FTP accounts, SSH keys, cron jobs and email forwarders you are sure are not yours. Ask your host if you are not sure.
  3. Change the database password. Put the new one in wp-config.php straight away, or WordPress cannot connect.
  4. Ask your host or a specialist to check the WordPress users while the site stays closed to visitors. They should note and remove unknown administrators, and reset the passwords of all users, including customers. They should also revoke every application password in the user profiles. These keep working after a user's normal password changes.
  5. Get new lines from the WordPress secret key tool. Use them to replace the eight key and salt lines in wp-config.php. This ends every current login, including the attacker's.
  6. Cancel any payment, courier and email (SMTP) keys or passwords saved on the site. Do this on each company's own website, and add new ones only when your site is clean.

An infected site can steal new passwords, so you will change them again after cleaning.

45 to 60 minutes: warn customers and choose a plan

Post this with your real number:

Assalam o Alaikum. Hamari website par security ka masla hai, is liye woh abhi band hai.
Website ya kisi anjaan link par password, OTP ya card details na likhein.
Order ke liye hamein 92 3XX XXXXXXX par message karein.
Website theek hone par hum yahan bata dein ge.

If customer or payment details may be affected, call your payment provider. Do not say the data is safe unless your investigation shows that. Tell affected customers what you know. If they use the same password elsewhere, ask them to change it there. Ask Pakistan's official cyber crime agency about reporting it, and a lawyer about your duties.

Should you restore or clean it?

Restore if you have a full backup from before the hack. Last night's copy may be infected too. If the first signs were three weeks ago, look for an older one.

Clean it with a specialist if you have no safe backup or the hack keeps coming back. Get help either way if your site takes payments.

If you restore

Backup first: check that the infected copy and any new orders are saved somewhere else before you empty a folder.

  1. Keep the site offline. Ask your host to empty only the correct website folder, so the hacker's extra files do not stay there. Do not restore on top of old files.
  2. Restore the clean files. Then restore the database from the same backup into a new, empty database. Update its details in wp-config.php.
  3. Update WordPress, themes and plugins. Remove any you do not need, and fix how the hacker got in.
  4. Repeat the account steps above, including users, application passwords, keys and saved payment, courier and SMTP keys. The backup may bring back old ones.

If you clean

Backup first: keep the infected copy as it is. Make a second private copy and work on that, not on the live site.

  1. Download the same WordPress version from WordPress.org. In your working copy, delete wp-admin and wp-includes, then add the clean folders. Replace the other core files in the main folder, but keep wp-config.php and wp-content. Look for extra files in the main folder.
  2. Delete each plugin and theme folder in the working copy, then add a clean copy from its maker. Copying on top can leave the hacker's files there. Keep custom and child themes for a developer to check.
  3. Check .htaccess, wp-config.php, wp-content/uploads and wp-content/mu-plugins. Files in mu-plugins load by themselves. Ask someone to check unknown files before you delete them, because some may be safe.
  4. Check the database, users and site address. Update everything, fix how the hacker got in, and repeat the account steps above.

Ask a specialist to check the cleaned copy. While the site is offline, the clean files and database must replace the old ones completely. Do not copy them on top. Then make a new backup and test it.

Why nulled plugins are a risk

Google says attackers often add harmful code to free copies of paid plugins and themes. Turning the plugin off is not enough. Remove all its files, check the site and get a clean copy from its maker or a licensed seller. We install and activate Elementor Pro, WoodMart and Astra Pro from our licence, but a genuine copy does not clean a hacked site.

Ask Google for a review

Do this only if Search Console shows a security issue. First clean the site, fix the cause and put it online where Google can open it.

  1. Open the Security issues report in Search Console.
  2. Fix every issue on all pages. The pages listed may be only a sample.
  3. Select Request Review. Explain the problem, what you fixed and how you checked it.

Made-up example, use only what is true for your site:

The site was sending some phone visitors to another site.
We restored clean files, updated WordPress and its plugins,
removed an unlicensed plugin and unknown users, and changed
all passwords and keys. We checked the listed pages and other
pages. They no longer send visitors to another site.

Google will email you when its review is finished. Do not send another request before then. Next, use our WordPress security checklist.

Common questions

Can a security plugin remove the hack?

It may find some harmful files, but it can miss others. It will not undo stolen passwords, so one clean scan is not proof.

Why does only Google send visitors to another site?

Some attackers show the redirect only to people coming from Google, so the owner does not notice. A normal-looking visit does not prove the site is clean.

Should I delete the website straight away?

No. Take it offline and save a private copy of the files, database and logs first. You may need them to find orders or see how the hacker got in.

Sources

Read next

Check a domain name