My WordPress site was hacked: clean up with passwords, scanning, a clean backup and updates
1. Has my site really been hacked?
Someone may have gained unauthorized access if:
- Visitors are redirected to another site (gambling, pharmacy, fake prizes).
- Spam pages in a foreign language appear in search results under your domain.
- The browser or a search engine warns that "this site may be harmful".
- WordPress has administrator users you didn't create.
- Large amounts of spam are sent from your account, or your hosting account hits its resource limits.
- Folders such as
wp-content/uploadscontain.phpfiles you don't recognize.
Before starting, check whether the site is harming visitors. If visitors are being sent to a malicious site, consider taking the site offline temporarily with a maintenance mode plugin until the clean-up is done.
2. Step 1: Change every password
The attacker may know one of your passwords. Cut off their access before cleaning:
- cPanel password: open Password & Security in the Preferences section of the cPanel home page and set a new, strong password. Change your customer panel password too.
- WordPress admins: in WordPress Manager by Softaculous, click Manage Users on your site's row. If the Username list contains users you don't recognize, note them and delete them in the WordPress dashboard. Change every administrator's password (details: B32).
- Database user: change the password of the site's database user in Manage My Databases, and put the same password in the
DB_PASSWORDline ofwp-config.php(B35). - FTP and email accounts: delete FTP accounts you don't use, and change the passwords of the rest and of your email accounts.
- Scan your own computer with an up-to-date antivirus. If passwords were stolen from your computer, new ones can be stolen too.
3. Step 2: Scan for malicious files
If Imunify360 appears in the Security section of your cPanel:
- Open Imunify360.
- Scan your account in the Malware Scanner section.
- Review the list of files found and use the clean-up or quarantine option the tool offers.
If Imunify360 doesn't appear, or it opens with a message saying the scanner isn't running, install a trusted security scanning plugin from the WordPress dashboard, scan the site, and let us know in a support ticket.
Besides what the scanners find, look in File Manager for files whose last-modified date is close to the time of the attack. There should be no .php files in wp-content/uploads.
4. Step 3: Return to a clean backup
If you have a backup taken before the attack, this is the most reliable way to clean up.
- Open the Backups and Restore list in Softaculous.
- Check the backup dates and find one from before the day the symptoms started.
- Click the Restore icon on that row.
- Leave Restore Directory and Restore Database ticked. Also tick Delete existing files/folders so files added by the attacker don't remain. Use this option only with a full directory backup.
- Click Restore Installation and wait for it to finish.
Restoring deletes posts, orders and comments added after the backup. If you run a WooCommerce store, export recent orders first. The restored site must be updated straight away so the hole is closed (step 4).
If you have no Softaculous backup, check the Account Backups section on the cPanel Backup page. As stated on our hosting page, daily and weekly backups are taken for accounts up to 2 GB; you can open a support ticket to ask about restoring from a backup with a suitable date.
5. Step 4: Update and clean everything
- In the WordPress dashboard, go to Dashboard → Updates and update WordPress, plugins and themes. Use the Re-install version … button on the same page to reinstall the WordPress core files as well.
- Delete plugins and themes you don't use. "Free" copies of paid plugins downloaded from unofficial sources are the most common source of infection; remove them and install the official versions.
- Replace plugins that haven't been updated for a long time or have been abandoned by their developer.
- If your PHP version is old, move to a current one (B34).
- Apply the security recommendations under Tools → Site Health.
6. Step 5: Harden your site
- In WordPress Manager, click Security Measures on your site's row.
- Turn on these measures in particular: Change default administrator's username, Block unauthorized access to xmlrpc.php, Disable file editing in WordPress Dashboard, Forbid execution of PHP scripts in the wp-content/uploads directory.
- Click Apply and test your site.
- Install a two-factor authentication plugin for administrators and keep the Loginizer plugin, which limits login attempts, turned on.
- Take regular backups (B38) and check for updates every week.
7. Step 6: Clear search engine warnings
- Verify your site in Google Search Console and check the Security issues report.
- Once the problem is fixed, request a review with Request review on the same screen.
- If spam pages still show in search results, hide them temporarily with the Removals tool; they disappear as the cleaned site is crawled again.
8. Common problems
| Symptom | Cause | Fix |
|---|---|---|
| Malicious code returns a few days after cleaning | A backdoor file remained or the hole wasn't closed | Restore a clean backup with Delete existing files/folders; update all plugins; change the passwords again. |
| A deleted unknown admin keeps coming back | A malicious plugin or theme file recreates the user | Delete plugins and themes of unknown origin; reinstall the core files. |
| The site doesn't open after restoring | The database password changed but wp-config.php wasn't updated |
Update the DB_PASSWORD line with the new password. |
| Spam keeps going out from the account | An email password was compromised, or a malicious mailer file is on the site | Change email passwords; scan again; open a support ticket. |
| The browser warning doesn't go away | The search engine hasn't reviewed the site yet | Request a review in Search Console. |
9. FAQ
Can the Gyro team clean my site?
You can do every step in this guide yourself from cPanel and the WordPress dashboard. Tell us in a support ticket which step you're stuck on and what you're seeing, and we'll point you to the tools available on your account. For an in-depth clean-up you can also work with a WordPress security specialist.
I have no backup. What can I do?
Clean the files found by the scan, reinstall the WordPress core, and reinstall all plugins and themes from their official sources. Then start taking regular backups.
Did the attacker access my customers' data?
If the database was accessed, it's possible. Consider resetting administrator and customer passwords, and consult your legal adviser about any notification obligations.
What's the single most important step to prevent this?
Staying up to date. Most attacks exploit known holes in plugins and themes that weren't updated.
Backing up a Softaculous site with one click before every major update lets you return to a clean version within minutes after an attack.
Next step
- B32: Resetting your WordPress admin password
- B38: Hosting settings and security checklist for a WooCommerce store
- B36: Exporting and importing databases with phpMyAdmin
Thanks for your feedback!
