Your homepage redirects to a spam site. Google shows a red warning. Your host has suspended the account. Or a customer has emailed to say something looks “off”. However you found out, the feeling is the same: your WordPress site has been hacked and you need to act now.

Take a breath. Most hacked WordPress sites can be cleaned and brought back, rankings included, if you work through the problem in the right order. This guide walks you through exactly what to do, step by step, and what to avoid so you don’t make things worse.

Signs Your WordPress Site Has Been Hacked

Some hacks are obvious. Others are built to stay hidden for months. Watch for these signs:

  • Redirects to spam, gambling, pharmacy or fake prize sites, often only on mobile or only for visitors coming from Google.
  • Browser or Google warnings such as “This site may be hacked” in search results, or a red “Deceptive site ahead” screen.
  • Strange pages in Google. Search site:yourdomain.com and look for pages in other languages or about products you don’t sell.
  • Admin users you didn’t create, or you can no longer log in with your own account.
  • Unknown files in your hosting account, especially PHP files inside wp-content/uploads.
  • A sudden slowdown or a spike in server resource use. A hidden script may be sending spam or mining on your server.
  • A message from your host saying the account has been suspended or is sending spam email.
  • A Security Issues alert in Google Search Console.

If you see one or more of these, treat it as a real incident until you have proved otherwise.

WordPress Hacked? What to Do in the First Hour

The first hour is about limiting the damage and keeping evidence. Don’t start deleting files at random yet.

1. Stay calm and write things down

Note what you saw, when you first noticed it, and anything that changed recently: a new plugin, a theme update, a new user, a developer given access. This timeline helps you, your host or a security specialist find the cause later.

2. Contact your hosting provider

Your host can often see things you can’t, such as server logs, other infected sites on the same account, and whether the problem started on the server. Many hosts will help with the first steps or point you to their own scanning tools. Ask them whether other sites on your account are affected too.

3. Put the site into maintenance mode (if you can)

If the hack is sending visitors to harmful pages, stop the harm first. A simple maintenance page protects your visitors and your reputation while you work. If you can’t log in, your host can usually help you block public access temporarily.

4. Take a snapshot of the hacked site

Before you clean anything, take a full backup of the files and database as they are now. Label it clearly as infected and never restore it to the live site. It’s your evidence: it helps you work out how the attacker got in and confirms what was changed.

Step by Step: How to Clean a Hacked WordPress Site

Once the damage is contained, work through these steps in order.

Step 1: Change every password

Assume every login linked to the site is compromised. Change:

  • All WordPress admin passwords (and ask every other user to reset theirs)
  • Hosting control panel password
  • FTP and SFTP accounts
  • The database user password (then update it in wp-config.php)
  • The email account linked to the site’s admin user

Use long, unique passwords from a password manager. Do this from a computer you trust. If your own device is infected, new passwords will be stolen again, so run a malware scan on it too.

Step 2: Reset the WordPress security keys

The security keys (salts) in wp-config.php sign the login cookies. Replacing them with fresh values logs everyone out, including the attacker, even if they had a valid session. WordPress.org provides a secret key generator you can use to create new ones.

Step 3: Remove unknown admin users

Go to Users in the dashboard and look for any administrator you don’t recognise. Check the database too (the wp_users table, or with your table prefix), because some hacks create admin accounts that are hidden from the dashboard. Remove what doesn’t belong, and reassign their content to a real user if prompted.

Step 4: Scan the site for malware

Use a reputable security plugin such as Wordfence or Sucuri, plus an external scanner, to find infected files. Scanners are a starting point, not the final word. They catch known patterns but can miss custom code, so always check the key files by hand as well.

Step 5: Replace WordPress core files

Download a fresh copy of the same WordPress version from WordPress.org. Replace the wp-admin and wp-includes folders completely over SFTP, rather than relying on the reinstall button inside a dashboard you can’t trust. If you use WP-CLI, wp core verify-checksums shows which core files have been changed.

Step 6: Reinstall plugins and themes from clean sources

Delete every plugin and theme folder and reinstall fresh copies from WordPress.org or the developer’s official site. Remove anything you no longer use. Never reinstall “nulled” (pirated) premium plugins or themes. They are one of the most common ways malware gets onto WordPress sites.

Step 7: Check the files hackers love to edit

Look carefully at:

  • .htaccess: for redirects you didn’t add
  • wp-config.php: for code above or below the normal settings
  • index.php in the site root
  • Your theme’s functions.php, header.php and footer.php
  • wp-content/uploads: this folder should hold media, not PHP files
  • The mu-plugins folder, which loads automatically and is easy to miss

Warning signs include long strings of random characters, eval(, base64_decode( and files with odd names or recent dates you can’t explain.

Step 8: Clean the database

Malware doesn’t only live in files. Check the wp_options table (especially siteurl, home and autoloaded options) and search posts and pages for injected scripts or hidden spam links. Look for unknown scheduled tasks (cron jobs) that could reinfect the site.

Step 9: Or restore a clean backup

If you have a backup from before the hack, restoring it can be the fastest route. But be careful: you need to know when the infection started, because many hacks sit quietly for weeks. After restoring, still change all passwords, reset the keys and update everything, or the same hole will be used again.

Step 10: Update everything and close the door

Update WordPress core, every plugin, every theme and your PHP version. Then work out how the attacker got in. The most common causes we see are outdated plugins, nulled software, weak or reused passwords and old, forgotten sites on the same hosting account. Fixing the symptom without fixing the cause usually means getting hacked again.

Getting Google to Trust Your Site Again

A clean site isn’t the end. If Google has flagged it, you need to tell Google it’s fixed.

  1. Check Search Console. Open the Security Issues report and see exactly what Google found. Check Manual actions too.
  2. Make sure Google can crawl the site. Don’t leave the site behind a login, a block in robots.txt or a noindex tag.
  3. Request a review. In the Security Issues report, click Request a review and briefly explain what you cleaned and how you fixed the cause. Only do this once you’re sure the site is clean, because a failed review slows things down.
  4. Be patient. Google says malware reviews usually take a few days, while reviews for spam hacks can take several weeks.
  5. Remove spam pages from search. Make sure hacked URLs now return a 404 or 410 status, and use the Removals tool in Search Console for any urgent ones.
  6. Resubmit your sitemap and request indexing for your key pages.

Also check whether your domain is on email blacklists if the site was sending spam. That can stop your normal business email from being delivered.

Mistakes That Make a Hack Worse

  • Only deleting the visible spam. Hacks almost always leave a backdoor so the attacker can get back in.
  • Restoring an infected backup and assuming the problem is solved.
  • Changing only your WordPress password and leaving hosting, FTP and database logins unchanged.
  • Requesting a Google review too early.
  • Waiting. The longer a hack runs, the more pages get indexed, the more visitors see warnings and the harder the clean-up becomes.

How to Stop Your WordPress Site Getting Hacked Again

Most hacks we clean up were preventable. A few habits make a big difference:

  • Keep core, plugins and themes updated, and remove anything you don’t use.
  • Use strong, unique passwords and turn on two-factor authentication for all admin accounts.
  • Give each person their own login with the lowest role they need. Never share the main admin account.
  • Run a security plugin with a firewall and login protection.
  • Keep automatic, off-site backups and test that you can restore them.
  • Choose quality hosting that isolates sites and scans for malware.
  • Avoid nulled plugins and themes, always.

Security and speed often go hand in hand. The same outdated plugins and bloat that slow a site down also widen the attack surface. Our guide on why WordPress sites get slow covers the clean-up side of that. If you’d rather not handle updates, backups and monitoring yourself, our WordPress maintenance service takes care of it every month.

When to Call a Professional

You can clean a simple hack yourself if you’re comfortable with SFTP, the database and reading code. Get expert help if:

  • The site keeps getting reinfected after you clean it
  • It’s an online shop or handles customer data
  • Google has flagged the site and you’re losing traffic and sales
  • You can’t log in at all, or you’re not sure what you’re looking at

Our WordPress malware removal service cleans the infection, finds and closes the way in, and helps get Google warnings removed. For WooCommerce stores, our WooCommerce maintenance keeps your shop updated and protected after the clean-up.

FAQs

How do I know if my WordPress site is hacked?

Common signs are redirects to spam sites, Google or browser warnings, strange pages in search results, unknown admin users, unfamiliar files on the server and alerts from your host or Search Console.

Can I fix a hacked WordPress site myself?

Often, yes, if you’re comfortable with SFTP, the database and checking code. The key is to remove every backdoor and fix the cause, not just the visible symptoms. If the site keeps getting reinfected, get professional help.

Will restoring a backup fix a hacked site?

Only if the backup was taken before the infection started. Even then, change all passwords, reset the security keys and update everything, or the attacker can use the same weakness again.

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

After you request a review in Search Console, Google says malware reviews usually take a few days, while spam hack reviews can take several weeks. Make sure the site is fully clean before you ask.

Will a hack hurt my Google rankings?

It can. Warnings scare visitors away and spam pages can damage how Google sees your site. Acting quickly, cleaning thoroughly and requesting a review gives you the best chance of recovering your rankings.

How can I stop my WordPress site getting hacked again?

Keep everything updated, remove unused plugins and themes, use strong passwords with two-factor authentication, run a security plugin, keep off-site backups and never use nulled software.

Need Help With a Hacked WordPress Site?

If your site has been hacked and you want it fixed properly, get in touch with our team. We’ll clean it, close the security hole and help you get back to business.