If your WordPress site has been hacked, do not panic and do not start deleting files at random. The safest fix follows a set order: contain the damage, take a backup of the hacked state, find and remove the malicious code, close the hole the attacker used, change every password, and then ask Google to review the site. This guide walks you through each step in plain English, so you know what to do yourself and when to call in help.
Signs your WordPress site has been hacked
Hacks are not always obvious. Some attackers deface your homepage, but many hide quietly and use your site for spam or redirects. Watch for these signs:
- Visitors (especially on mobile) are redirected to spam, gambling or fake prize pages.
- Google shows “This site may be hacked” under your listing, or Chrome shows a red “Deceptive site ahead” warning.
- Strange pages in Google results when you search
site:yourdomain.com, often in Japanese or full of pharmacy keywords. - New administrator users you did not create.
- Unknown plugins, or PHP files inside
wp-content/uploads. - Your host suspends the account or warns you about malware or outgoing spam email.
- You cannot log in, even with the correct password.
If you see one or more of these, treat it as a hack until you have proved otherwise.
Step 1: Contain the damage
Your first job is to stop visitors from being harmed while you work.
- Put the site in maintenance mode if you can still reach the dashboard. This keeps visitors off infected pages.
- Tell your hosting company. On shared hosting the infection can spread across other sites in the same account, and good hosts will help you scan the server and check logs.
- Do not keep editing content. Every change you make now can overwrite clues about how the attacker got in.
Step 2: Back up the hacked site before you touch anything
It sounds strange to back up a broken site, but it matters. A cleanup step can break the site, and the hacked copy holds the evidence you need to find the entry point. Take a full backup of the files and the database and store it somewhere separate from your normal backups so you never restore it by mistake.
Then check whether you have a clean backup from before the hack. If you set up a proper routine like the one in my guide to WordPress backups, restoring a known-good copy can be the fastest path back. Just remember that restoring alone does not fix the hole the attacker used, so you still need steps 4 to 6.
Step 3: Find and remove the malware
This is the part that takes the most care. Work through the site in this order.
Replace WordPress core files
Download a fresh copy of WordPress from WordPress.org and replace the wp-admin and wp-includes folders and the root files. Do not overwrite wp-config.php or the wp-content folder, because they hold your settings and content. Then open wp-config.php and check it line by line for code that does not belong.
Reinstall plugins and themes from trusted 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 a “nulled” (pirated) premium plugin: they are a common way malware gets in.
Check the uploads folder
The wp-content/uploads folder should hold images and documents, not PHP files. Attackers often hide backdoors there. Look for any .php file and remove it, then block PHP from running in that folder (your host or a security plugin can do this for you).
Clean the database
Check the users table for admin accounts you do not recognise and delete them. Search posts, pages and the options table for injected scripts, hidden links and <iframe> or eval( code. Spam pages created by the attacker also need to be deleted.
Scan to confirm
Run a server-side scan with a reputable security tool, and an external scan such as Sucuri’s free checker and cleanup guide. One clean scan is not proof, so scan again after a day or two to make sure nothing has come back.
Step 4: Close the hole the attacker used
If you only remove the malware, the attacker will simply walk back in through the same door. The most common entry points on small business sites are:
| Entry point | How to close it |
|---|---|
| Outdated plugin or theme with a known vulnerability | Update everything, remove unused plugins, replace abandoned ones |
| Weak or reused admin password | Strong unique passwords and two-factor login for every admin |
| Nulled premium plugins or themes | Delete them and buy or replace with legitimate versions |
| Old WordPress core or PHP version | Update WordPress and ask your host for a supported PHP version |
| Too many admin accounts | Give each person only the role they need |
| Infected neighbouring site on the same hosting account | Clean or remove old test sites and staging copies |
Your host’s access logs often show the exact file or URL the attacker used. It is worth asking for them.
Step 5: Reset every password and key
Assume every password connected to the site is known to the attacker. Change all of them:
- All WordPress user passwords (force a reset for every admin and editor).
- Hosting control panel, FTP/SFTP and SSH passwords.
- The database password (then update it in
wp-config.php). - The security keys and salts in
wp-config.php, which logs everyone out. - API keys for payment gateways, email (SMTP) and any connected services.
The official WordPress.org “my site was hacked” FAQ also recommends changing passwords as one of the first recovery steps.
Step 6: Remove Google’s “hacked” warning
Once the site is completely clean, open Google Search Console and go to the Security issues report. It lists what Google found. Fix every issue on every page, because cleaning only some pages does not earn a partial return to search results.
Then click Request review and briefly explain what you removed and which vulnerability you closed. Google’s guide to requesting a review says reviews can take from a few days to a few weeks, and that warnings are removed within about 72 hours once the site is found clean. Do not submit early: a failed review slows things down.
After the review, check that your SSL certificate is still valid with my free SSL checker, and test your redirects so no spam redirect is left behind.
Should you fix it yourself or hire help?
You can handle a simple infection yourself if you are comfortable with FTP, file managers and the database. Hire a professional if:
- The site takes payments or stores customer data.
- The hack keeps coming back after you clean it.
- Google or your host has already flagged or suspended the site.
- You are not sure what a file does and do not want to break the site.
A WordPress developer can clean the site, find the entry point, and harden it so it stays clean. If you would like me to take a look, my WordPress development service covers hack cleanup and recovery.
How to stop it happening again
Most WordPress hacks are not clever. They use outdated plugins, weak passwords and missing backups. After recovery, put these habits in place:
- Update WordPress core, plugins and themes every week.
- Keep automatic off-site backups and test a restore now and then.
- Use two-factor login and limit login attempts.
- Remove plugins and themes you do not use.
- Run a security plugin with a firewall and file-change alerts.
- Review admin users every month.
My 15-step WordPress security guide covers each of these in detail, and the WordPress maintenance guide shows how to fit them into a simple routine. If you would rather not do it yourself, a monthly website maintenance plan handles updates, backups and security checks for you.
Frequently asked questions
How do I know if my WordPress site is hacked?
Common signs are spam redirects, a “This site may be hacked” note in Google, unknown admin users, strange pages in search results, PHP files in the uploads folder and warnings from your host. A scan with a security plugin and an external scanner will confirm it.
Can a hacked WordPress site be fixed?
Yes. Almost every hacked WordPress site can be recovered by restoring a clean backup or removing the malware by hand, then closing the vulnerability and changing all passwords.
Will restoring a backup fix a hacked site?
Restoring a clean backup removes the infected files, but it does not fix the weakness the attacker used. If you restore and do nothing else, the site can be hacked again within days. Always update everything and reset passwords after a restore.
How long does it take to remove a Google hacked warning?
After you request a review in Search Console, Google says reviews can take from a few days to a few weeks. Once the site is confirmed clean, browser and search warnings are usually removed within 72 hours.
Why does my WordPress site keep getting hacked?
Repeat hacks usually mean a backdoor was left behind or the original vulnerability was never closed. Check the uploads folder, wp-config.php, unknown admin users and any old sites in the same hosting account.
Need help with a hacked site?
A hacked website is stressful, but it is fixable. If you want it cleaned, secured and back in Google’s good books without the guesswork, contact me and tell me what you are seeing. I will tell you honestly what it needs.