All articles Maintenance

WordPress Hacked? How to Tell, What to Do First and How to Clean Your Site (2026)

Signs that your WordPress site has been hacked, what to do in the first hour, how to clean it step by step, how hacks happen and how to stop it happening again.

WP Beekeeper Team · 13 min read
Laptop with a warning sign and a security shield being repaired: cleaning a hacked WordPress site

You open your website and it redirects to a casino. Or Google shows a red warning before anyone can reach your homepage. Or your host emails you that your account has been suspended for sending spam. However you found out, the feeling is the same: your WordPress site has been hacked, and you need to know what to do next.

First, the good news: almost every hacked WordPress site can be fully cleaned and brought back. The bad news is that the order of your first steps matters. Deleting the wrong files, restoring an infected backup or simply changing one password can leave the attacker a way back in, and the site is reinfected a week later.

This guide walks you through the whole process: how to recognise a hack, what to do in the first hour, how to clean your site step by step, how WordPress sites usually get hacked and how to make sure it does not happen again. It is based on the incidents we handle as part of maintaining more than 90 WordPress sites.

Key takeaways

  • Typical signs: redirects to spam sites, a Google warning, unknown admin users, strange files, a suspended hosting account or a sudden drop in traffic.
  • In the first hour: do not delete anything, take a copy of the infected site, change passwords from a clean device and put the site into maintenance mode if it harms visitors.
  • Cleaning means more than removing visible malware: replace core files, reinstall plugins and themes from official sources, check uploads and the database, and close the hole the attacker used.
  • The most common cause is an outdated plugin or theme with a known vulnerability, followed by weak or reused passwords and pirated (nulled) plugins.
  • After cleaning, request a review from Google if your site was flagged, and watch the site closely for at least 30 days.
  • Prevention is cheaper than cleanup: regular updates with backups, strong passwords with two-factor login, no unused plugins and continuous monitoring.

Signs that your WordPress site has been hacked

Some hacks are obvious. Many are not: modern malware often hides from logged-in administrators and only shows its effects to visitors from Google or on mobile. These are the signs we see most often:

What you noticeWhat it usually means
Visitors are redirected to spam, casino or pharmacy sitesInjected JavaScript or a modified .htaccess file, often only active for visitors coming from Google or on mobile
Google shows “This site may be hacked” or a red warning pageGoogle has detected malware or spam pages. Traffic drops sharply until the site is cleaned and reviewed
Strange pages in Google results (Japanese text, cheap products)SEO spam: the attacker created thousands of pages to rank for their own keywords
Admin users you never createdThe attacker has an account and can return at any time
Your host suspended the account or warns about spam emailsThe site is sending spam or attacking other sites
The site is very slow or the server load is highHidden scripts are mining, sending mail or attacking other sites
Unknown PHP files, especially in /wp-content/uploads/Backdoors that let the attacker run code on your server
Changed content, defaced homepageA visible attack, often through a compromised account
Your antivirus or browser blocks the siteThe site is on a public blocklist

How to check quickly

  • Search Google for site:yourdomain.com and look for pages you never created.
  • Open Google Search Console and check “Security issues” and “Manual actions”.
  • Visit your site from a phone using mobile data, ideally by clicking a Google result. Many redirects only trigger that way.
  • In WordPress, go to Users and sort by role. Every administrator you do not recognise is a red flag.
  • Ask your host whether they found malware. Many hosts scan accounts and can tell you which files are affected.

What to do in the first hour

The first hour is about limiting damage and preserving evidence, not about cleaning. Resist the urge to delete everything or to restore last month’s backup immediately. You may not know yet when the site was infected, and older backups can contain the same backdoor.

  1. Do not delete the site or reinstall WordPress yet. The infected files show how the attacker got in. Without them, you are guessing.
  2. Take a full copy of the infected site. Files and database, stored separately and clearly labelled as infected.
  3. Change your passwords from a clean device. Hosting account, WordPress admin accounts, FTP/SFTP and database. If your own computer might be compromised, use another one.
  4. Protect your visitors. If the site redirects visitors or spreads malware, put it into maintenance mode or ask your host to take it offline temporarily.
  5. Write down what you noticed and when. Screenshots of redirects, warnings and emails help to find the cause.
  6. Never send passwords by email, not even to the person helping you. Share access through a password manager or temporary accounts.

Hacked right now?We clean hacked WordPress sites the same day, 7 days a week: malware removed, the hole closed and a review requested from Google. From 399 euros.

Get help today →

How to clean a hacked WordPress site, step by step

Cleaning a hacked site properly takes a few hours for a simple site and longer for a large shop. The steps below are the process professionals follow. If you are not comfortable working with files, the database and server access, this is the moment to get help: a half-cleaned site is often reinfected within days.

Step 1: Secure a copy and work on a known state

Keep the infected copy from the first hour. Then check your backups: if you have a backup from before the infection, it can save a lot of work, but only if you are sure about the date. Many infections stay hidden for weeks before they become visible, so “last week’s backup” is not automatically clean.

Step 2: Find out how the attacker got in

This is the step most people skip, and the reason so many sites get hacked twice. Look at the server access logs around the time the first malicious files appeared, check which plugins and themes had known vulnerabilities in the versions you were running, and check whether any admin account was created or logged in at unusual times. If you clean the site without closing the entry point, the attacker simply comes back.

Step 3: Replace WordPress core files

Download a fresh copy of the same WordPress version from wordpress.org and replace the wp-admin and wp-includes folders and the core files in the root directory. Keep your wp-config.php, but check it line by line for code that does not belong there. Also check the .htaccess file for redirects you did not add.

Step 4: Reinstall plugins and themes from official sources

Do not try to clean infected plugin files by hand. Delete every plugin and theme folder and install fresh copies from wordpress.org or from the official vendor. Remove anything you do not use, and never reinstall a “nulled” (pirated) premium plugin: these are one of the most common ways malware gets onto WordPress sites in the first place.

Step 5: Check the uploads folder

The /wp-content/uploads/ folder should contain images and documents, not code. Search it for .php files and for files with double extensions such as image.jpg.php. Any PHP file in uploads is almost certainly a backdoor. Also look for recently modified files in other folders that are not part of WordPress, plugins or themes.

Step 6: Clean the database

  • Remove administrator accounts you did not create, and check every remaining admin.
  • Search posts, pages and widgets for injected <script> tags, hidden links and iframes.
  • Check the options table for suspicious entries, especially the site URL, home URL and options that contain encoded code.
  • Delete spam pages and posts the attacker created, and note their URLs for Google.

Step 7: Reset all access

Change every password again now that the site is clean: all WordPress users with elevated roles, hosting, SFTP, the database and any API keys stored on the site. Generate new security keys and salts in wp-config.php; this logs out every active session, including the attacker’s. Turn on two-factor login for all administrators.

Step 8: Update everything

Bring WordPress, every plugin and every theme to the latest version, and make sure your server runs a supported PHP version. If the attacker used a plugin with a known vulnerability, the update is what actually closes the door. Our guide to updating WordPress safely shows the right order.

Step 9: Scan again and test the site

Run a security scan on the server and an external scan of the public site. Then test like a visitor: click through Google results on a phone, submit your forms, run a test order in your shop. Only when everything is clean and working should you take the site out of maintenance mode.

Step 10: Tell Google and your host

If Google flagged your site, request a review in Search Console under “Security issues” and describe what you cleaned. Reviews usually take a few days. Remove spam URLs that remain in the index with the removals tool, and let your host know the site is clean so they can lift any suspension or mail limits.

Cleanup checklist

  • Copy of the infected site saved
  • Entry point identified and closed
  • WordPress core files replaced
  • Plugins and themes reinstalled from official sources, unused ones removed
  • No PHP files in uploads, no unknown modified files
  • Unknown admin users and injected code removed from the database
  • All passwords, keys and salts changed, two-factor login on
  • WordPress, plugins, themes and PHP up to date
  • Clean results from server and external scans
  • Google review requested, host informed

How WordPress sites get hacked

WordPress itself is well maintained and security fixes arrive quickly. Most hacks do not target WordPress core but the things around it. In the sites we clean, the causes are almost always one of these:

CauseHow it happensHow to prevent it
Outdated plugins or themesA known vulnerability is published, bots scan millions of sites for it within daysInstall security updates quickly, with a backup first
Abandoned pluginsThe plugin is no longer maintained, so vulnerabilities are never fixedReplace plugins without updates for more than a year
Nulled (pirated) themes and pluginsFree copies of premium products often contain a backdoor from the startOnly install from wordpress.org or the official vendor
Weak or reused passwordsBots try leaked passwords against wp-login.phpUnique passwords, a password manager and two-factor login
Too many admin accountsOld employee or agency accounts are forgotten and get compromisedGive admin rights only to people who need them, remove old accounts
Compromised hosting or other sites on the accountOne infected site spreads to all others on the same hosting accountSeparate important sites, keep every site on the account updated
Outdated PHP versionOld PHP versions no longer receive security fixesRun a PHP version that is still supported

The pattern is clear: most hacks are not targeted attacks but automated scans for known weaknesses. That is good news, because it means routine maintenance prevents most of them.

When to get professional help

You can clean a simple site yourself if you know your way around files, databases and server logs. Get help if any of the following applies:

  • The site is a shop or handles customer data, so a data breach is possible.
  • The site was reinfected after an earlier cleanup.
  • Google has flagged the site and you are losing traffic or sales every day.
  • Your host has suspended the account.
  • You do not know how the attacker got in.
  • You do not have a clean backup or do not know when the infection started.
Do it yourselfProfessional cleanup
TimeSeveral hours to several daysUsually the same day
CostYour time, possibly scanner licencesTypically a few hundred euros, depending on the site
Risk of reinfectionHigh if the entry point is missedLow, the cause is identified and closed
Google reviewYou write the request yourselfPrepared and submitted for you

If your site has been hacked and you want it fixed today, our emergency WordPress malware removal responds the same day, seven days a week.

After the cleanup: the next 30 days

A cleaned site is vulnerable for a while. If something was missed, it usually shows within days. For the first month:

  • Check the site daily from a phone and through Google results.
  • Watch Search Console for new security warnings and unexpected new pages.
  • Run a security scan at least weekly.
  • Check the list of administrator accounts weekly.
  • Keep daily backups and keep the infected copy until you are sure the site stays clean.

How to prevent your WordPress site from being hacked again

Prevention checklist

  • Install updates regularly, security fixes within days, always with a backup first
  • Remove plugins and themes you do not use
  • Replace plugins that have not been updated for a year
  • Only install plugins and themes from official sources, never nulled copies
  • Unique, long passwords and two-factor login for every admin
  • As few administrator accounts as possible
  • A supported PHP version
  • Daily backups stored outside the server, tested regularly
  • Uptime and security monitoring that alerts you within minutes
  • A monthly look at a maintenance report, so problems do not go unnoticed

If you want a detailed routine, our WordPress maintenance checklist covers every task with its frequency, and the WordPress backup guide explains how to set up backups you can actually restore. What a professional plan should cover is explained in our guide to WordPress maintenance plans.

Prevention that runs itself.WP Beekeeper keeps WordPress, plugins and themes up to date with a backup before every update, checks your pages afterwards and monitors uptime, SSL, email and DNS around the clock. From 29 euros per site and month.

See how it works →

Sources and further reading

Frequently asked questions

How do I know if my WordPress site has been hacked?

Typical signs are redirects to spam or casino sites, a Google warning, strange pages in search results, admin users you did not create, unknown PHP files in the uploads folder, a suspended hosting account or a sudden drop in traffic. Check Google Search Console under “Security issues” and search Google for site:yourdomain.com.

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

Do not delete anything yet. Take a full copy of the infected site, change your hosting and WordPress passwords from a clean device, put the site into maintenance mode if it harms visitors and write down what you noticed. Then find the entry point before you start cleaning.

Can I just restore a backup?

Only if you are sure the backup was made before the infection and you close the hole the attacker used. Many infections stay hidden for weeks, so recent backups often contain the same backdoor, and without an update the attacker can get in again the same way.

How do hackers get into WordPress sites?

Most often through outdated or abandoned plugins and themes with known vulnerabilities, followed by weak or reused passwords, pirated (nulled) premium plugins, forgotten admin accounts and other infected sites on the same hosting account.

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

A professional cleanup of a typical site takes a few hours and is usually done the same day. Doing it yourself can take several hours to several days. If Google flagged the site, the review after cleaning usually takes a few more days.

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

Professional malware removal typically costs a few hundred euros depending on the size of the site and the damage. WP Beekeeper cleans hacked WordPress sites from 399 euros, the same day, seven days a week.

How can I protect WordPress from being hacked again?

Keep WordPress, plugins and themes updated with a backup before every update, remove unused plugins, use unique passwords with two-factor login, keep few admin accounts, run a supported PHP version and monitor the site continuously.

Conclusion

A hacked WordPress site is stressful, but it is rarely the end of the site. Act in the right order: preserve the evidence, secure your accounts, find how the attacker got in, clean thoroughly and close the hole. Then put a routine in place that keeps your site updated, backed up and monitored, because almost every hack we see could have been prevented by maintenance that simply happened on time.

Never think about WordPress updates again.Backup first, updates in the right order, a visual check of every page and a clear monthly report. Try WP Beekeeper free for 14 days, no credit card needed.

Start your free trial →