Blog

WordPress Site Hacked? What to Do in the First Hour (and After)

WordPress site hacked? Here is exactly what to do in the first hour, how to clean the infection, get Google to remove its warning, and close the hole so it does not…

WordPress site hacked: first-hour field guide by Rahatul Ahsan Rafi, Senior WordPress Developer

Stop. Don’t delete anything yet. When a WordPress site is hacked, the first instinct is to start ripping out plugins and reinstalling everything. That often destroys the clues you need to find how the attacker got in, and it doesn’t remove the backdoor they left behind. This guide walks you through the first hour, the cleanup, getting Google to trust your site again, and making sure it doesn’t happen twice.

Quick answer

If your WordPress site is hacked: take a full backup of the hacked site, change every password (hosting, WordPress, FTP, database), remove unknown admin users, then restore a clean backup or replace core, theme and plugin files with fresh copies. Scan the uploads folder and database for injected code, update everything, and request a review in Google Search Console if it flagged your site. Then fix the hole that let them in.

What’s inside this guide
  1. Signs your WordPress site is hacked
  2. The first hour: what to do right now
  3. The four kinds of hacks I see most
  4. How to clean a hacked WordPress site
  5. Getting off Google’s warning list
  6. Find out how they got in
  7. Lock it down so it doesn’t happen again
  8. Clean it yourself or get help?
  9. FAQ
  10. Clean is not the same as safe

Signs Your WordPress Site Is Hacked

Some hacks are loud. Most are quiet, because attackers make more money when you don’t notice. Many infections show bad content only to Google or only to mobile visitors coming from search, so the site looks fine when you visit it yourself.

What you noticeWhat it usually meansHow to check
Visitors from Google land on a casino, pharmacy or scam pageMalicious redirectSearch your business name on your phone and tap your own result
Japanese or casino text in your Google resultsSEO spam pagesSearch site:yourdomain.ca on Google and scroll
“Deceptive site ahead” or “This site may be hacked” warningGoogle flagged malware or hacked contentSearch Console → Security & Manual Actions → Security issues
Admin users you didn’t createBackdoor accessUsers → All Users, filter by Administrator
Host suspended the account or flagged spam emailMalware or a mailer script on the serverRead the host’s email, check the file manager for odd PHP files
Site suddenly slow, CPU limits hitSpam generator, crypto miner or bot trafficHost resource stats, access logs
Customers report card fraud after checkoutCredit card skimmerCheck checkout pages for unknown scripts. Treat as urgent.
WordPress site hacked symptom map: redirect, SEO spam, backdoor admin and card skimmer signs
Match what you see to the likely type of hack. The type tells you where to look first.

The First Hour: What to Do Right Now

Work through these in order. None of them need technical skill, and together they stop the damage from growing while you plan the cleanup.

  1. Breathe, then write down the timeNote when you first noticed and what you saw. Take screenshots of the warning, the spam results or the redirect.
  2. Back up the hacked siteYes, the infected one. Download all files and the database. It’s evidence, and it saves you if a cleanup goes wrong.
  3. Change every passwordHosting account, every WordPress admin, SFTP/FTP, the database user (then update wp-config.php to match), and the email tied to the admin account. Turn on two-factor authentication wherever you can.
  4. Remove unknown admin usersDelete any administrator you don’t recognise. Check for users with odd emails or names like “wpadmin2” and “support_wp”.
  5. Tell your hostThey can see server logs and often scan for you. Some will help free of charge. Ask whether other sites on your account are infected too.
  6. If you sell online, pause paymentsSwitch WooCommerce to “catalogue only” or put checkout in maintenance mode until you’re sure there’s no skimmer.
Important

If customer card data or personal information may have been exposed, you may have a legal duty to report it. Under the GDPR and UK GDPR, notifiable breaches go to the regulator within 72 hours where feasible. Australia, Canada and most US states have their own breach-notice rules. Talk to your payment provider and, if needed, a lawyer before you post anything public.

The Four Kinds of Hacks I See Most

Large scanners see the same patterns. In Sucuri’s SiteCheck report for 2024, malware and malicious redirects showed up in 74.7% of infected sites, and SEO spam in 38.4%. Japanese SEO spam alone had more than 117,000 detections. Here’s what each one looks like on a small business site.

1Malicious redirects

Visitors are sent to scam pages, often only on mobile or only from Google. The code usually hides in theme files, .htaccess, or a script injected into the database.

2SEO spam

Thousands of fake pages selling pills, knock-offs or casino links, built to rank on your domain’s trust. You may not see them at all from your browser.

3Backdoors and fake admins

Hidden PHP files or rogue admin users that let the attacker come back after you “clean” the site. This is why quick fixes fail.

4Card skimmers

JavaScript on the checkout page that copies card details as customers type. Less common, far more serious.

From my client files

An auto repair shop in Leeds found out they’d been hacked from a customer. She told the owner his Google listing “looked Japanese.” He checked the website on his laptop and it looked perfect. That’s the trick: the spam pages were only shown to Google’s crawler.

A site: search showed over 3,000 spam URLs. The way in was a slider plugin that hadn’t been updated in years. We removed it, cleaned the database and files, regenerated the security keys, and submitted the clean-up in Search Console. The warning cleared in about six days, and his rankings for “brake repair Leeds” came back over the next few weeks.

How to Clean a Hacked WordPress Site

You have two paths. Pick based on whether you have a backup from before the hack.

Path A: Restore a clean backup

If you have a backup from before the infection started, this is usually the fastest route. The catch: you need to know roughly when the hack began, and you still need to close the hole afterwards, or you’ll be hacked again within days.

  • Restore files and database from a date before the first sign of trouble.
  • Immediately update WordPress, all plugins and the theme.
  • Change all passwords again and regenerate security keys.
  • Re-add any real content created since that backup.

Path B: Clean the site in place

No clean backup? Then you replace everything that can be replaced, and inspect what can’t.

  1. Replace WordPress coreDownload a fresh copy from WordPress.org and overwrite wp-admin and wp-includes. Don’t touch wp-content or wp-config.php yet.
  2. Reinstall plugins and the themeDelete each plugin folder and install a fresh copy from WordPress.org or the vendor. Delete any plugin you don’t recognise or don’t use.
  3. Check the uploads folderUploads should hold images and documents. A .php file in there is almost always malicious.
  4. Inspect key files by handLook at wp-config.php, .htaccess, and the mu-plugins folder for code you didn’t add, especially long encoded strings.
  5. Clean the databaseSearch posts and options for injected <script> tags and strange URLs. Check that the site URL in Settings → General is still yours.
  6. Regenerate security keysReplace the salts in wp-config.php with new ones from the WordPress.org generator. This logs everyone out, including the attacker.
  7. Scan againRun a security plugin scan and an outside scanner. Then check your site from a phone, on mobile data, through a Google search.

If you have SSH access and WP-CLI, these two commands save a lot of time. They compare your files against the official versions and list anything that’s been changed:

wp core verify-checksums
wp plugin verify-checksums --all

Anything they flag needs a closer look. Files that don’t belong at all are often the backdoor.

Tip

Don’t rely on a single “malware removal” plugin to do everything. Scanners are good at finding known patterns, and attackers write new ones every week. A scan plus fresh files plus a manual look is what actually works.

Getting Off Google’s Warning List

If Google flagged your site, the warning won’t lift by itself. You need to ask for a review after the cleanup.

  1. Open Search ConsoleGo to Security & Manual Actions → Security issues. Note every issue type and the sample URLs.
  2. Confirm the samples are cleanOpen each sample URL. Use URL Inspection to see the page the way Googlebot sees it.
  3. Request a reviewExplain in a few sentences what you found, what you removed, and what you fixed (for example, “removed spam pages, deleted an outdated slider plugin that was exploited, updated all plugins”).
  4. Remove spam URLs from resultsMake sure spam pages return a 404 or 410, and use the Removals tool for the worst ones.
Issue typeTypical Google review time
PhishingAbout a day
MalwareA few days
Hacked with spamUp to several weeks

Those timings come from Google’s own guidance on web.dev. Don’t resubmit while a review is in progress; it doesn’t speed things up.

Find Out How They Got In

Cleaning without finding the entry point is like mopping the floor while the tap is still running. These are the usual doors, most common first:

  • An outdated or abandoned plugin. Patchstack’s 2026 report found 91% of new WordPress vulnerabilities in plugins, and only six in core during 2025.
  • A “nulled” (pirated) theme or plugin. These often ship with a backdoor already inside.
  • A weak or reused admin password with no 2FA.
  • An old admin account belonging to a past developer or employee.
  • A neighbouring infected site on the same hosting account.
  • Old PHP that no longer gets security fixes.

Your host’s access logs show which files were requested around the time the hack started. Look for POST requests to plugin files or to odd PHP files in uploads. That usually points straight at the hole.

Lock It Down So It Doesn’t Happen Again

Stop doing
  • Sharing one admin login with everyone
  • Keeping plugins “just in case”
  • Installing free downloads of paid themes
  • Waiting a month to apply security updates
  • Storing backups only on the same server
Start doing
  • One user per person, with the lowest role they need
  • Two-factor authentication for every admin
  • A firewall and login limits (security plugin or host)
  • Weekly updates, with a backup first
  • Daily off-site backups kept for 30+ days

That list is most of what a good WordPress maintenance plan does every week. If you’re also seeing errors after the cleanup, my guide to common WordPress errors can help you sort them out.

Clean It Yourself or Get Help?

You can clean a simple infection yourself if you have a clean backup, you’re comfortable with a file manager, and nothing sensitive was exposed. Get help if any of these are true:

  • The site takes payments or stores customer data.
  • You cleaned it once and it came back.
  • Google shows a red warning and you’re losing leads every day.
  • Your host suspended the account.
  • You have no backup from before the hack.

Repeat infections are almost always a missed backdoor. A second pair of eyes is cheaper than a third cleanup.

Rahatul Ahsan Rafi, Senior WordPress Developer

Hacked right now? I clean infected WordPress sites, find the entry point, and handle the Google review. You get a written report of what was found and fixed.

Get help with a hacked site

More on how I handle urgent fixes on my WordPress bug fixing page.

Frequently Asked Questions

How do I know if my WordPress site is hacked?

Common signs are redirects to spam sites, strange pages in a site: search on Google, a browser or Google warning, unknown admin users, a host suspension, or a sudden slowdown. Many hacks only show to Google or mobile visitors, so check from a phone through a Google search.

Can a hacked WordPress site be fixed?

Yes. Almost every hacked WordPress site can be cleaned by restoring a clean backup or replacing core, theme and plugin files and removing injected code. The key is also finding and closing the entry point, or the hack comes back.

How long does it take to clean a hacked WordPress site?

A simple infection with a clean backup can be fixed in an hour or two. A site with thousands of spam pages and no backup can take a day of work. Google’s review after the cleanup can take from a day to several weeks, depending on the issue type.

Will reinstalling WordPress remove malware?

Only partly. Reinstalling core replaces wp-admin and wp-includes, but malware often hides in plugins, themes, the uploads folder, wp-config.php or the database. You need to clean all of those too.

Why does my site redirect to spam only on mobile?

Attackers often target mobile visitors from search engines because site owners usually test on desktop and type the address directly. The redirect code checks the device and referrer before acting. Test from a phone on mobile data, through a Google search.

How do I remove the “This site may be hacked” warning from Google?

Clean the site, make sure spam URLs return 404 or 410, then open Search Console → Security issues and click Request Review with a short explanation of what you fixed. Google reviews hacked-spam sites in up to several weeks.

Do security plugins stop WordPress hacks?

They help a lot with firewalls, login limits and scanning, but they don’t replace updates, strong passwords, two-factor authentication and off-site backups. Most hacks come from outdated plugins that a security plugin can’t patch for you.

How much does it cost to fix a hacked WordPress site?

One-time cleanups from developers and security companies commonly range from about $150 to $600 for a small site, more for stores or heavy spam infections. Some maintenance plans include cleanup at no extra cost, so check yours first.

Clean Is Not the Same as Safe

A clean site today can be re-infected next week through the same hole. Treat the cleanup as step one. Step two is closing the door: updates every week, two-factor for every admin, fewer plugins, and backups you’ve actually tested. Do that, and a hack goes from a disaster to a bad afternoon.

Sources: Patchstack, “State of WordPress Security in 2026” (February 2026); Sucuri / GoDaddy, SiteCheck 2024 Threat Report; Google, “Request a review” on web.dev and the Search Console Security issues report help page; WordPress.org developer documentation for WP-CLI checksum commands; UK ICO guidance on personal data breaches (UK GDPR) and GDPR Article 33 on breach notification.

Share this articleLinkedInXFacebook
Rahatul Ahsan Rafi, Senior WordPress Developer
Written by

Rahatul Ahsan Rafi

Senior WordPress Developer

I have spent 13+ years building fast, high-converting websites across 1,650+ projects for businesses in the US, UK, Canada and Australia. On this blog I share what actually works, from development and SEO to AI automation.

  • 13+years with WordPress
  • 1,650+projects delivered
  • 4countries served
Hi, I'm Rahatul 👋 Need website help? Let's talk.