Finding out your WordPress site has been hacked is stressful, especially if customers are seeing it. The good news is that almost every hacked WordPress site can be cleaned and recovered. What you do in the first hour makes a big difference to how quickly that happens, and to whether the hacker can get straight back in.
Signs your WordPress site has been hacked
- Visitors are redirected to spam, gambling or fake pharmacy sites, sometimes only on mobile or only when they arrive from Google.
- Google shows “This site may be hacked” under your listing, or browsers show a red “Deceptive site ahead” warning.
- Your host has suspended the site or emailed you about malware.
- There are administrator accounts in WordPress that you didn’t create.
- Searching Google for
site:yourdomain.co.ukshows pages you never made, often in other languages. - Your site has suddenly become very slow, or your host reports unusual resource use or spam email being sent.
What to do in the first hour
1. Don’t delete everything or restore blindly
It is tempting to wipe the site or restore last week’s backup. Hold off for a moment. The hacker may have been in for longer than you think, so recent backups can contain the same infection. Keep a copy of the site as it is now: it is the evidence of how they got in.
2. Change every password, from a clean device
Change the passwords for all WordPress administrator accounts, your hosting account, SFTP/FTP, and the database (updating wp-config.php to match). Do this from a computer you trust, in case the original breach came from malware on your own machine.
3. Remove users you don’t recognise
In WordPress, go to Users and filter by Administrator. Delete any accounts you didn’t create, and check the others still have the email addresses you expect. Creating a hidden admin is one of the first things attackers do.
4. Log everyone out
Changing passwords doesn’t end sessions that are already logged in. To force everyone out, replace the security keys (“salts”) in wp-config.php with a fresh set from the official generator at api.wordpress.org/secret-key/1.1/salt/.
5. Protect your visitors
If the site is redirecting visitors or serving malware, consider putting it into maintenance mode, or ask your host to take it offline temporarily while you clean it. That protects your customers and limits the damage to your reputation with Google.
6. Scan the site
A security plugin such as Wordfence, or an external checker such as Sucuri SiteCheck, will often find infected files. Treat a clean scan with caution, though: scanners miss well-hidden code, so it isn’t proof the site is clean.
How to clean a hacked WordPress site properly
Removing the obvious malware isn’t enough. Hacked sites usually have a “backdoor”, a hidden file that lets the attacker back in after you clean up. A thorough clean-up covers:
- WordPress core: replace every core file with a fresh copy. With WP-CLI,
wp core verify-checksumsshows which core files have been altered. - Plugins and themes: reinstall each one from its official source, and delete any you don’t use. Remove “nulled” (pirated) premium plugins entirely, as they are a common source of infections.
- Uploads folder:
wp-content/uploadsshould contain images and documents, not PHP files. Any.phpfile in there is suspicious. - Config files: check
wp-config.phpand.htaccessfor code you didn’t add, such as long strings of random characters or redirects. - The database: look for injected scripts in posts, pages and the options table, and for spam pages created by the attacker.
- The way in: find how they got in, usually an outdated plugin or theme, or a weak password, and close it. Otherwise it will happen again.
After the clean-up
- Remove the Google warning: in Google Search Console, open Security issues, confirm the problems are fixed, and request a review. Reviews usually take from a few days to a couple of weeks.
- Check blocklists: make sure your domain isn’t still listed by browser and email blocklists, or your emails may go to spam.
- Consider your legal duties: if customer personal data may have been exposed, UK GDPR may require you to report the breach to the Information Commissioner’s Office (ICO) within 72 hours of becoming aware of it. The ICO website explains when a report is needed.
- Stop it happening again: keep WordPress, plugins and themes updated, use strong unique passwords with two-factor authentication, keep off-site backups, and monitor the site so problems are spotted early.
Want it cleaned up for you?
Page Guard’s London-based developers clean hacked WordPress sites, close the security hole, and help get Google warnings removed. The diagnosis is free, one-off fixes start from £55, and if we can’t fix it you get a full refund. See how we fix hacked WordPress sites, get emergency WordPress support, or call 020 3376 1925.
Already back online? Our WordPress maintenance plan includes daily security scans, backups and updates, so you aren’t caught out again.