Perhaps visitors are being redirected to a strange website. Perhaps your host has suspended your account, or a browser shows a warning when someone opens your homepage. Or perhaps you noticed an administrator account you never created.
Whatever the trigger, the first reaction is often to start deleting things. Resist that for a moment. A hacked WordPress site is recoverable in most cases, but the order of the steps matters. Acting in the wrong order can destroy the clues you need, or leave the attacker a way back in.
Recognise the signs of a compromise
Some signs are obvious, others are easy to miss:
- redirects to unknown sites, often only for visitors coming from search engines or on mobile;
- new pages, spam links or foreign-language content you did not publish;
- administrator accounts or users you do not recognise;
- plugins you did not install, or security plugins that have been deactivated;
- unknown PHP files in
wp-admin,wp-includesor theuploadsfolder; - a warning from your host, your bank or a search engine;
- a sudden slowdown or unusual outgoing email traffic.
One sign alone does not prove a break-in, but two or three together are reason enough to follow this checklist.
In the first hour, contain without destroying evidence
- Take a snapshot of the current state. Before you change anything, make a copy of the files and the database as they are now. This infected copy is not for restoring; it is for understanding what happened later.
- Limit the damage. If the site is actively harming visitors, put it into maintenance mode or ask your host to restrict access temporarily.
- Tell your host. They can often see server logs you cannot, and they need to know if other sites on the same account might be affected.
- Write things down. Note what you saw, when, and what you have done since. You will need this timeline if you have to inform anyone.
Change every key, not just one password
Assume every credential connected to the site is known to the attacker.
- WordPress passwords for all administrators, not only yours.
- Hosting control panel, FTP/SFTP and SSH credentials.
- The database password (update
DB_PASSWORDinwp-config.phpto match). - Any API keys stored on the site, for example for email delivery or payment services.
Then replace the security keys (salts) in wp-config.php with fresh ones from the official generator at api.wordpress.org/secret-key/1.1/salt/. Changing the salts invalidates every existing login session, including the attacker's.
Finally, review the user list and delete any account you cannot account for. Check roles, too: a familiar username that has quietly become an administrator is a classic sign.
Find out what changed
Knowing what was modified helps you decide between cleaning and restoring.
- Core files. If you have WP-CLI,
wp core verify-checksumscompares your WordPress core files with the official checksums published by WordPress.org. Modified files and files that should not exist will be listed. Our guide on checking WordPress core file integrity explains how to read the results. - Plugins.
wp plugin verify-checksums --alldoes the same for plugins hosted on WordPress.org. Premium plugins cannot be checked this way. - Recently modified files. Look for PHP files changed around the suspected date, especially in
wp-content/uploads, which should normally contain only media. - The database. Look for unknown administrators in the users table and for injected scripts in posts, widgets and options.
- Server logs. Access logs can show which URL was used for the first request, which often points to the vulnerable plugin or the compromised account.
Clean up or restore a known good backup
If you have a backup from before the break-in, restoring it is usually faster and more reliable than hunting for every injected line of code. The difficulty is knowing when the break-in actually happened: a backup taken after the attacker arrived simply restores the problem. This is one reason why keeping backups for several weeks matters, as explained in our guide to the 3-2-1 backup rule.
After restoring, or if you clean the site by hand:
- reinstall WordPress core from a fresh copy (Dashboard → Updates → Re-install, or
wp core download --skip-content --force); - reinstall each plugin and theme from its official source rather than trusting the existing files;
- check
wp-config.phpand.htaccessby eye, as they are not covered by core checksums; - remove any plugin or theme you do not use.
If the infection is extensive or keeps coming back, bring in a specialist. There is no shame in that; persistent backdoors can be hard to find.
Close the door that was used
A cleaned site that is still vulnerable will be hacked again, sometimes within days. Common entry points are:
- an outdated plugin or theme with a known security hole;
- a weak or reused administrator password, without two-step login;
- a compromised hosting or FTP account;
- an abandoned plugin that no longer receives fixes.
Update everything, remove what you do not need, and strengthen access with our guide on how to secure your WordPress login. Disabling the built-in file editor with define( 'DISALLOW_FILE_EDIT', true ); in wp-config.php also makes life harder for anyone who gets into the dashboard again.
Inform the people who need to know
If the site processes personal data, such as contact forms, customer accounts or orders, a break-in may also be a data security breach. In Switzerland, the revised Federal Act on Data Protection (FADP) can require you to report certain breaches to the Federal Data Protection and Information Commissioner (FDPIC). Under the EU's GDPR, reports to the supervisory authority are generally due within 72 hours of becoming aware of a breach. Whether this applies depends on your situation, so check with your data protection adviser early rather than late.
Also tell your client or employer, and request a review from search engines if your site was flagged as dangerous.