You almost always find out by chance. A customer tells you your site is opening strange pages, Google shows a red warning, search results in Japanese appear under your domain, or your hosting provider suspends your account. A hacked WordPress site is serious, but with the right steps it can almost always be recovered. This is the sequence I follow, in the order it makes sense to do it.
How to tell if your site has been hacked
- The site redirects visitors elsewhere, often only on mobile or only when they arrive from Google.
- Pages you never created show up on Google, sometimes in other languages.
- Your browser or Google flags the site as dangerous.
- You find administrator accounts you don’t recognise.
- The site has become very slow, or your host reports unusual resource use or outgoing spam.
Even one of these signs is worth checking. The longer you wait, the further the problem spreads and the harder it is to clean up.
1. Don’t delete anything, make a copy
The first instinct is to delete suspicious files or reinstall everything. Before that, make a full copy of the files and database exactly as they are, and store it off the server. You need it to understand how the attackers got in and to avoid losing content you may not have anywhere else. If your host has backups from before the attack, note their dates: they may come in handy.
2. Limit the damage
If the site is sending visitors to malicious pages, put it into maintenance mode or ask your host to block it temporarily. A few hours offline is better than customers landing on scam sites under your name.
3. Change every password
WordPress logins for every administrator, the hosting control panel, FTP or SFTP, the database and any email accounts on the domain. If you use the same password elsewhere, change it there too. Also regenerate the WordPress security keys in wp-config.php: this logs out every open session, including the attacker’s.
4. Check your administrator accounts
Attackers often create an administrator with an anonymous-looking name, or change the email address of an existing user. Go through the list under Users, check emails and roles, and remove anyone you don’t recognise.
5. Look for malicious code everywhere
Modified files are only half the problem. There are many places to check:
- WordPress core files, compared against the originals;
- themes and plugins, including inactive ones;
- the uploads folder, which should not contain PHP files;
- files such as .htaccess and wp-config.php, and the mu-plugins folder;
- the database: modified options, scripts injected into posts, hidden users and scheduled tasks that reinstall the malware.
Security scanners help find the bulk of it, but they are not enough on their own. This is where experience counts: a half-finished clean-up brings the problem back within days.
6. Reinstall from clean sources and update everything
WordPress, the theme and plugins should be reinstalled from official sources, not restored from the infected files. Then bring everything up to the latest version. Abandoned plugins, or ones downloaded from unofficial sites, need replacing: they are among the most common ways in.
7. Ask Google to review the site
If Google flagged the site, once it is clean open Search Console, check the Security issues report and request a review. When the review succeeds, the warning disappears. If spam pages were created, make sure they don’t stay indexed.
8. Consider your data protection duties
If customer data passes through the site, such as contact forms, orders or accounts, a breach may involve that data too. Under the GDPR, the data controller must notify the supervisory authority of breaches likely to put people at risk within 72 hours of becoming aware of them. If in doubt, talk to whoever handles privacy for your business straight away.
How to stop it happening again
- Regular updates for WordPress, the theme and plugins.
- Automatic backups stored off the server, and tested now and then.
- Strong, unique passwords, with two-factor authentication for administrators.
- Few plugins, well chosen and maintained by their authors.
- Someone who checks the site regularly and spots problems before you do.
That is exactly what I do with WordPress maintenance.
When to ask for help
If your website matters to your business, don’t lose days to trial and error. With WordPress support I start with a fixed-price check-up: I tell you what happened, what it takes to really clean the site and how to prevent it from happening again. I also work on sites built by others. Write to me or call me: in emergencies I reply the same day.
