Blog
WordPress hacked in 2026? What to do now, and how to stop it coming back
Back up the site as it is, tell your host, and change every password from a clean computer. Then clean or restore the site, and close the hole the attacker used, or it will be back.
In short
- In the first hour: write down what you see, tell your host, back up the infected site, and change every password from a computer you have scanned.
- A proper cleanup replaces all WordPress, plugin and theme code with fresh copies. Deleting the files that look wrong is not enough.
- Infections come back when a backdoor, a stolen password or the original outdated plugin is left in place.
- WordPress core is actively maintained. The usual ways in are plugins, themes, weak passwords and neglected updates.
- To end the cycle you can maintain the site properly, pay someone to do it, or move to a static site whose live copy has no admin login, no database and no plugins.
What should you do first when your WordPress site is hacked?
Take a full backup of the site as it is, tell your hosting company, and change every password from a computer you trust. Do those three things before you delete or restore anything. Speed matters less than doing things in the right order.
Here is the first hour, in order. A site owner can do all of it, or hand the list to a host or developer. This is general guidance, not advice for your particular site: if a step is unclear, ask your host before you do it.
- Write down what you see. Note the symptoms, when you first noticed them, and anything that changed recently, such as a new plugin, a new user or an update. Whoever cleans the site will ask.
- Tell your host. Your host can confirm whether this is a hack or an ordinary fault, whether other sites in your account are affected, and whether they hold a clean backup. Ask them for a list of any infected files their scanner has found.
- Back up the infected site. Copy both the files and the database, and label the copy as infected. It is evidence of what happened, and a safety net if the cleanup removes something you need.
- Limit the damage. If visitors are being redirected or shown a warning, ask your host to take the site offline or put up a holding page while you work.
- Scan your own computer. Malware on a laptop can steal website logins. Run a full scan on every device used to manage the site before you type a new password on it.
- Change every password. That means the hosting control panel, SFTP or FTP, the database, every WordPress administrator, and the email account that receives password resets. Use a long, unique password for each.
Do not start deleting files that look suspicious, and do not restore a backup over the top yet. Both can destroy the evidence of how the attacker got in, and that is what you need to stop a repeat.
WordPress publishes its own guide to a hacked site, which follows the same order and is worth reading alongside this one.
How do you know a WordPress site has been hacked?
A site has probably been hacked when it does something you did not set up: redirects visitors, shows content you did not write, or has users you did not create. Malware is the general name for any code placed on a site to do harm, and it is usually written to stay hidden from the owner. That is why the first sign often comes from a customer, a browser warning or your host.
| What you see | What it usually means | First thing to do |
|---|---|---|
| Visitors are sent to another site, often only from search results or on phones | A script or redirect rule has been added to the site’s files | Ask your host which files changed recently |
| A browser or search result shows a warning about the site | A search engine has flagged the site as harmful | Clean the site first, then request a review |
| Administrator accounts you did not create | Someone else has full control of the dashboard | Back up, remove the accounts, change all passwords and keys |
| Pages or search results in your name that you never wrote | Spam content has been added to the files or the database | Compare against a clean backup |
| Your host has suspended the account | The host detected malware, or spam email sent from the site | Ask the host exactly what they found |
| You can no longer log in | The password or email on your account was changed | Ask your host to help you reset it |
One symptom is enough to act on. Several at once usually means the attacker has had access for a while.
How do you clean a hacked WordPress site?
You clean a hacked WordPress site by replacing all of its code with fresh copies, checking the parts that cannot be replaced, and then changing every password and key. Removing only the files that look wrong tends to leave something behind.
There are two routes. If you have a backup from before the infection began, restoring it is the quickest. If you do not know when it began, clean the site in place. Take a backup before either.
- Replace WordPress itself. Download a fresh copy of the same WordPress version. Using SFTP or your host’s file manager, delete the old
wp-adminandwp-includesfolders and upload the fresh ones. Leavewp-contentandwp-config.phpwhere they are; they hold your uploads and settings. This is better than a reinstall button, which can leave behind files the attacker added. - Replace every plugin and theme. Delete each one and install it again from its original source. Remove any plugin or theme you are not using; inactive code can still be attacked.
- Check the files that cannot be replaced. These are
wp-config.php, the.htaccessfile, your theme’s own files and the uploads folder. The uploads folder should hold images and documents, not program files. - Check the database. Look at the list of users under Users, and at recent posts and pages, for anything you do not recognise. Injected scripts and links can sit inside page content, where replacing files does not reach them. Hand this step to a developer if you are unsure.
- Update everything. Bring WordPress, every plugin, every theme and the PHP version up to date, so the hole that was used is no longer there.
- Change every password again. The first round locked the attacker out. This round is the one you can trust, because it happens on a clean site.
- Replace the secret keys. WordPress stores a set of security keys in
wp-config.php. Replacing them signs every user out, including anyone still logged in with a stolen session. Your host can do this for you. - Revoke other access. Remove application passwords you do not recognise from each user’s profile, and rotate any keys stored in the site for email, payment or other services.
- Scan again, then ask for a review. If Google flagged the site, the Security issues report in Search Console is where you request a review once the site is clean.
If any step is unclear, stop and ask your host. A wrong edit to wp-config.php can take the site offline, and a backup is what makes that mistake recoverable.
Why does WordPress malware keep coming back?
WordPress malware comes back when the cleanup removed the visible damage but left the way in. An infection has two parts: what it does, and how the attacker returns. Cleaning the first without the second gives you a tidy site that is soon infected again.
The usual causes of reinfection are these.
- A backdoor was left behind. A backdoor is a small piece of hidden code that lets the attacker back in without a password. It is often a single file with an ordinary-looking name, tucked into a folder nobody opens.
- The original hole is still open. If the attacker came in through an outdated plugin and that plugin is still installed and still outdated, the same attack works again.
- A password is still known. Changing the WordPress password does nothing if the hosting, SFTP or database password was the one stolen, or if a computer that manages the site is infected.
- A rogue user remains. An extra administrator account, or an application password on a real account, survives a file cleanup.
- The backup was already infected. Restoring a backup taken after the break-in puts the malware back.
- Another site in the same account is infected. Sites that share one hosting account can often reach each other’s files. Clean one and leave another, and the infection spreads back.
- A pirated plugin or theme is in use. Paid plugins offered free from unofficial sources can arrive with malware already inside them.
If your site has been cleaned more than once, assume one of these is true and work through the list. The step that is easiest to skip is replacing all the code, because it takes the longest.
Is WordPress itself insecure?
No. WordPress core is actively maintained, has a dedicated security team, and can install its own security releases automatically. The usual ways in are plugins, themes, weak or reused passwords and updates that nobody applied.
The cause is structural. A WordPress site is a program that runs on every visit. It has a login page, a database and a collection of extensions written by different authors, and each of those has to be kept up to date. Miss that upkeep for long enough and one of them becomes the way in.
So the honest question is not whether WordPress is safe. It is whether somebody is doing that upkeep on your site, every month, and what happens when they stop.
How do you stop a WordPress site being hacked again?
You stop repeat hacks by reducing the number of ways in and by making sure someone watches the ones that remain. There are several ways to do that, and they are not exclusive.
| Option | What it fixes | What it leaves |
|---|---|---|
| Keep everything updated, with fewer plugins | Closes known holes in plugins, themes and core | Needs someone to do it regularly, and updates can break things |
| Strong passwords and two-factor authentication | Stops stolen and guessed logins | Does nothing about vulnerable plugins |
| Better hosting | Isolation between sites, server-side scanning, reliable backups | The site’s own code is still yours to maintain |
| A security service or firewall | Filters known attacks and alerts you to changes | A recurring cost, and it is a layer on top, not a cure |
| A maintenance service | A person applies updates, tests and monitors | A recurring cost; quality varies |
| A static site | Removes the login, the database and the plugins from the live site | Editing works differently; some features need replacing |
A few habits make the biggest difference whichever route you take.
- Remove every plugin and theme you do not use. The Site Health screen, under Tools in the dashboard, lists the inactive ones.
- Give each person their own account, and keep administrator rights to the people who need them.
- Keep backups somewhere other than the web server, and test that one can be restored.
- Apply updates promptly, but not blindly. Updates carry their own risk, which is covered in what to do when a plugin update breaks your site.
WordPress documents the technical side in its guide to hardening WordPress, which is the right thing to hand a developer.
Would a static site stop the hacks?
A static site removes those usual routes, because the live site has no admin login, no database and no plugins. A static site is a set of finished pages, built in advance and served as plain files. Nothing on the live site accepts a password or runs a plugin on each visit.
That is a real reduction, and it is not a promise of safety. A static site still depends on its hosting account and its domain account, and those need strong passwords and two-factor authentication. Any third-party script or form service you add is also something to keep an eye on.
It also changes how you work. On a WordPress site anyone with a login can publish at once. On a static site, changes are made in the source and then published, which suits a brochure, lead-generation or content site and does not suit a shop, a membership site or a busy newsroom. Features that plugins used to provide, such as forms, search and comments, each need a deliberate replacement. WordPress or static sets out the trade-offs, including when staying is the better choice.
A migration is not an emergency cleanup. If your site is infected today, contain it and clean it first, using the steps above. The time to consider moving is afterwards, when you are deciding whether to keep paying for the upkeep.
If you reach that point, WPEject does the move for you and handles the part that protects your search traffic: the redirect map, the metadata and the checks before and after launch. What a WordPress to static migration includes explains the work, and you can ask for a free exit audit to find out whether your site is a good fit.