If your WordPress site is hacked, back it up, then check the core files with WordPress Toolkit and scan the account with ImunifyAV. Delete files and accounts you do not recognise, change every password and the secret keys, and update or remove the plugin or theme that let the attacker in.
A hacked WordPress site can redirect visitors, send spam, steal data or serve malicious code to anyone who loads a page. This guide is for site owners on cPanel or Plesk hosting who think their site has been hacked. It covers how to confirm it, how to clean the site with the tools in your control panel, and how to stop it happening again.
You are probably hacked if you see any of these:
wp-content/uploads folder, or files change when you have not updated anything.For a quick outside check, paste your address into an external scanner such as Sucuri SiteCheck or VirusTotal. They only see what a visitor sees, so a clean result does not rule out a backdoor on the server. The scans below check the files themselves.
Work through these steps in order. Each one is explained in its own section below.
wp-config.php.If you cannot get the site clean, open a support ticket with the ImunifyAV report and the file paths involved.
An attacker usually finds a vulnerability in a plugin, a theme or WordPress itself, or logs in with a stolen password. Their first move is typically to upload a backdoor file, which gives them a way back in even after you delete the obvious damage. From there they can change existing files, add email accounts to send spam, or create scheduled tasks in your control panel.
Deleting the suspicious files does not fix the problem. The vulnerability or stolen password must be dealt with as well, or the site will be infected again.
WordPress Toolkit compares your core WordPress files with the official checksums. A mismatch means a core file has been modified, which is a common sign of compromise. The check does not cover files that hold site-specific data, such as wp-config.php and index.php.

WordPress Toolkit.

Check WordPress Integrity results.
This replaces tampered core files but does not touch your plugins, themes or uploads folder, so carry on with the steps below.
ImunifyAV scans every file on your hosting account, including files outside WordPress, and flags malicious content.

ImunifyAV in your control panel.

Detected malware listed in the ImunifyAV Malicious tab.
On our reseller platform we also scan servers for malware from time to time, but we only contact you when malware is found on your accounts or an abuse report is raised against them. Hearing nothing does not mean a clean scan has run recently, so scan your own accounts after any suspicion.
Scanners only catch what they have a signature for, so check the files by hand as well.
Brand-new malware may not be in any scanner’s signature list. Open your control panel’s file manager or an FTP client and sort by Last Modified. Look for files that changed without a matching plugin or theme update, and for these signs:
ajwzxq.php.eval() or base64_decode()./wp-content/uploads/, where executable files should never appear..htaccess file in your site root. Attackers often use it to redirect visitors.
Sorting by Last Modified in cPanel File Manager helps identify recently changed files.
If you have SSH access, you can search from the command line. Replace /var/www with the path to your WordPress installation. This lists every PHP file changed in the last seven days:
“ find /var/www -type f -name '*.php' -ctime -7 “
This lists PHP files in the uploads folder:
“ find /var/www/wp-content/uploads -name "*.php" “
Before you delete a suspicious file, check whether it belongs to a plugin or theme. If it does not, delete it. If it does, that plugin or theme is compromised: delete it and reinstall it from the official source.
Attackers harvest FTP, control panel and WordPress logins. If you leave the old credentials in place, the site can be infected again straight after you clean it.

Update passwords for all WordPress user accounts.
Then replace the secret keys (salts) in wp-config.php with a fresh set from the WordPress secret key generator. This logs out anyone who is still signed in, including the attacker. If the database password may have been exposed, change it in your control panel and update wp-config.php to match.
Change the password for every FTP account on the site. To see or remove FTP accounts, follow how to add an FTP account.

Change FTP account passwords in cPanel.

Change FTP account passwords in Plesk.

Change your cPanel password from the client area.

Change your Plesk password from the client area.
Resellers can only change their own password in the client area. To change passwords for other users, use your control panel directly.
Compromised sites often gain new users, sometimes with administrator rights. Go to Users in your WordPress dashboard, review the full list and click Delete next to any account you do not recognise.

Delete any unrecognised accounts from the WordPress Users list.
Attackers may add FTP accounts to keep access after a clean-up. Delete any you did not create.

Remove unrecognised FTP accounts in cPanel.

Remove unrecognised FTP accounts in Plesk.
Attackers often create email accounts on a compromised site to send spam. Delete any you did not create, and change the password on the ones you keep.

Email Accounts in cPanel.

Delete unrecognised email accounts in cPanel.

Remove unrecognised mail accounts in Plesk.
With the credentials changed and the unknown accounts gone, the attacker’s routes back in are closed. Next, deal with the weakness that let them in.
Cleaning without fixing the cause means reinfection. These steps cover the usual causes.
Outdated software is the most common way WordPress sites are compromised, because updates often patch known vulnerabilities. WordPress Toolkit and Softaculous both show available updates and can apply them automatically. You can also update from the dashboard: go to Plugins and click Update beneath any outdated item. Turn on automatic updates for plugins where you can; see how to enable auto-updates for WordPress plugins.
Nulled plugins and themes are pirated copies of paid software, and they often arrive with malware already installed. Install from the official WordPress repository or from the developer’s own site. Be wary of a plugin that has not been updated in over a year or has few users. Delete plugins you no longer use, because a deactivated plugin can still be exploited while its files are on the server.
A security plugin adds monitoring and protection. Wordfence, for example, offers rate limiting, IP blocking, malware scanning and two-factor authentication for logins, with free and paid tiers. Our blog post on security plugins for WordPress compares the options.
Both tools can apply security hardening in a few clicks. In WordPress Toolkit, go to Fix Vulnerabilities, then Security Measures.

Security Measures in WordPress Toolkit.
In Softaculous, open your WordPress installation and go to the security settings. The Critical Only preset applies the measures least likely to affect how your site works. You can switch on individual measures too, but read the tooltip for each one first, because some change how the site behaves.

Softaculous WordPress Management.

Softaculous Security Measures with the Critical Only preset.
WordPress recommends 755 for directories and 644 for files, and 400 or 440 for wp-config.php. Looser permissions make it easier for an attacker to write or change files. Check them after a compromise.
If the account holds more than one WordPress site, each needs the same clean-up. Malware can move between installations that share a file system, so a clean site next to an infected one can be reinfected.
Yes. Most hacked sites can be cleaned, and a backup from before the infection gives you a clean starting point. You can restore one with JetBackup. On our WordPress hosting, JetBackup takes a backup every four hours, so a recent restore point is usually there. Restoring does not close the hole the attacker used, so you still need to update or remove the vulnerable plugin or theme and change your passwords, or the site will be hacked again. Watch the site and ImunifyAV for new detections over the following days.
If malware reappears after a clean-up, the vulnerability behind the first infection is still open. Removing files treats the symptom, not the cause.
wp-config.php.A site that served malware may be on a blacklist, which can hurt search rankings and trigger browser warnings.
Scanners can raise false positives, particularly on obfuscated but legitimate code in some commercial plugins and themes.
If you cannot log in to wp-admin because the site is broken, see how to disable plugins using WordPress Toolkit. To get back in with a new password, see resetting your WordPress admin password.
Once the site is clean, set up regular backups so you always have a clean restore point, and force HTTPS if you have not already.
Tuned for WordPress, with one-click installs.
From £5.99/mo
View WordPress HostingDid this guide solve your problem?
Our UK support team answers tickets and live chat every day. Send us the guide you were following and where it stopped working.
Related guides
Get fast, secure and reliable WordPress Hosting with optimised for performance with AccelerateWP.
Get WordPress HostingCreate fully isolated individual accounts for your clients and manage them all from one dashboard.
Get Reseller Hosting