If your WordPress site has been hacked, defaced, or is sending spam, don't panic. This is fixable. Ultra Web Hosting includes Imunify360 malware scanning on all accounts, which may have already caught and quarantined the malicious files. This guide walks you through the full cleanup process step by step. If you'd rather have our team handle it, we offer consultation services for exactly this.
- How to Tell If You've Been Hacked
- Immediate Steps (Do These First)
- Check Imunify360 for Detected Threats
- Change Every Password
- Finding the Malware
- Cleaning Infected Files
- Hunting for Backdoors
- Check Your Database
- Update WordPress, Plugins, and Themes
- Regenerate Security Keys
- Harden Your Site to Prevent Reinfection
- Dealing With Google Blacklisting
- When to Restore From Backup Instead
- When to Call in Professional Help
01. How to Tell If You've Been Hacked
WordPress hacks don't always look like a defaced homepage. Many infections are designed to be invisible so they can keep running as long as possible. Watch for these signs:
- Your site redirects to a spam or gambling site
- Google search results show strange titles or descriptions for your pages
- You see new admin users you didn't create
- Your hosting account is sending spam email
- Imunify360 notifications in cPanel about detected malware
- Your site is suddenly very slow or crashes frequently
- Strange PHP files appear in
wp-content/uploads/ - Google or your browser shows a "This site may be hacked" warning
- You get a suspension notice from your hosting provider
02. Immediate Steps (Do These First)
Before you start cleaning, do these three things to stop the bleeding:
- Change your WordPress admin password immediately through cPanel's phpMyAdmin if you can't log in normally (see section 04).
- Change your cPanel and FTP passwords from your Ultra client area.
- Check Imunify360 in cPanel for any files it has already detected and quarantined (see section 03).
03. Check Imunify360 for Detected Threats
Your Ultra hosting account runs Imunify360, which scans for malware automatically. It may have already found and quarantined the infected files.
- Log into cPanel
- Click the Imunify360 icon (under the Security section)
- Check the Malware Scanner tab for detected files
- Review the list. Imunify shows the file path, threat type, and detection date.
- Click Clean All to let Imunify attempt automatic cleanup, or review each file individually
Imunify's automated cleanup works well for common infections like injected base64 code and known malware signatures. For more sophisticated backdoors, you may need to clean manually (covered in sections 06 and 07).
After Imunify cleans files, check your site to make sure it still works. Sometimes Imunify removes code that looks malicious but is actually part of a legitimate plugin (this is rare but it happens). If something breaks, check the Imunify quarantine to restore the file.
04. Change Every Password
Assume all credentials are compromised. Change everything:
- WordPress admin password - through WP Admin > Users, or through phpMyAdmin if locked out
- cPanel password - through your Ultra client area > Services > Manage
- FTP passwords - through cPanel > FTP Accounts
- Database password - through cPanel > MySQL Databases. After changing it, update
wp-config.phpwith the new password - Email account passwords - through cPanel > Email Accounts
Resetting WordPress password via phpMyAdmin (if locked out)
- Open phpMyAdmin from cPanel
- Select your WordPress database
- Click on the
wp_userstable (your prefix may be different) - Click Edit on the admin user row
- In the
user_passfield, select MD5 from the function dropdown - Type your new password in the value field and click Go
05. Finding the Malware
If Imunify didn't catch everything, you'll need to look manually. Here are the most common hiding spots:
Check for PHP files in the uploads directory
There should be no PHP files in wp-content/uploads/. Any PHP file here is almost certainly malware. In cPanel's File Manager, browse to wp-content/uploads/ and search for *.php.
Check for recently modified files
Via SSH or Terminal in cPanel, run:
# Find PHP files modified in the last 7 days
find ~/public_html -name "*.php" -mtime -7 -ls
# Find files with suspicious names
find ~/public_html -name "*.php" | grep -E "(eval|base64|shell|backdoor|tmp)"
Check for unknown files in theme and plugin directories
Hackers often drop backdoor files with random names inside theme directories like wp-content/themes/yourtheme/. Look for files that don't match the theme's normal structure. Names like class-db.php, admin-ajax-handler.php, or random strings like xkw8r.php are red flags.
06. Cleaning Infected Files
Reinstall WordPress Core
The safest way to clean core files is to replace them entirely. In WP Admin, go to Dashboard > Updates and click Reinstall Now. This replaces all core files without touching your content, themes, or plugins.
Alternatively, via SSH:
wp core download --force --skip-content
Reinstall plugins and themes
Delete and reinstall every plugin and theme from the official WordPress repository or the vendor's site. Don't just "update" them, since an update won't remove files that the attacker added to the plugin's directory.
Delete anything you don't recognize
If you find PHP files that aren't part of WordPress core, your theme, or your plugins, delete them. When in doubt, compare against a fresh copy of the plugin or theme from the vendor.
Never use "nulled" (pirated) plugins or themes. These are the #1 source of backdoor infections we see. Every single nulled plugin we've examined contains injected malware.
07. Hunting for Backdoors
Backdoors are what let hackers back in after you've cleaned the obvious malware. They're designed to survive a cleanup. Common patterns to search for:
# Search for common backdoor signatures
grep -r "eval(base64_decode" ~/public_html --include="*.php"
grep -r "eval(\$_" ~/public_html --include="*.php"
grep -r "system(\$_" ~/public_html --include="*.php"
grep -r "preg_replace.*\/e" ~/public_html --include="*.php"
grep -r "assert(" ~/public_html --include="*.php"
grep -r "str_rot13" ~/public_html --include="*.php"
Also check for files with misleading names placed in directories where they don't belong, like wp-includes/SimplePie/Decode/editCourseGrades.php or wp-content/themes/yourtheme/fonts/admin.php. Legitimate WordPress files don't have names like that.
Hackers often install cron jobs that re-download the malware even after you've deleted it. Check cPanel > Cron Jobs for anything you didn't add. Via SSH, run crontab -l to see all scheduled tasks. Remove anything suspicious, especially entries with wget, curl, or base64 in them.
08. Check Your Database
Some infections inject malicious content into your database rather than files. Open phpMyAdmin and check:
- wp_users - Look for admin accounts you didn't create. Delete any unknown administrators.
- wp_options - Search for
siteurlandhomevalues. If these have been changed to a different domain, that's why your site is redirecting. Fix them to your correct domain URL. - wp_posts - Search for
<scriptoreval(in post content. Injected JavaScript in posts is a common spam technique.
09. Update WordPress, Plugins, and Themes
After cleaning, update everything to the latest versions. Most hacks exploit known vulnerabilities in outdated software. If the vulnerability that let them in still exists, they'll be back.
- Update WordPress core to the latest version
- Update every plugin to the latest version
- Update your theme to the latest version
- Delete any plugins and themes you're not actively using
- Make sure you're running PHP 8.2 or 8.3 (older PHP versions have known security issues)
10. Regenerate Security Keys
WordPress uses security keys (AUTH_KEY, SECURE_AUTH_KEY, etc.) to encrypt login cookies. After a hack, you should regenerate these to force all existing sessions to log out, including any sessions the attacker may still have.
- Visit api.wordpress.org/secret-key/1.1/salt/ to generate fresh keys
- Open your
wp-config.phpfile - Replace all 8 existing key/salt lines with the new ones
- Save the file
This immediately invalidates all logged-in sessions. Everyone (including you) will need to log in again with their new passwords.
11. Harden Your Site to Prevent Reinfection
Once the site is clean, lock it down so this doesn't happen again:
- Install BBQ Firewall - lightweight, zero-config request filtering that blocks common attack patterns at the application level.
- Set file permissions to 755 for directories, 644 for files, and 600 for wp-config.php.
- Add security .htaccess rules - block PHP execution in uploads, disable directory browsing, protect sensitive files. See our WordPress Security guide for the full ruleset.
- Enable two-factor authentication on all admin accounts.
- Set up automated backups with UpdraftPlus to an off-server location so you have a clean restore point if something happens again.
12. Dealing With Google Blacklisting
If Google has flagged your site with a "This site may be hacked" warning, you need to request a review after cleaning:
- Log into Google Search Console (add your site if you haven't already)
- Check the Security Issues section for details on what Google found
- After cleaning the site, click Request a Review
- Describe what you did to fix the issue
- Google typically reviews within 1-3 business days
Until the warning is removed, your site will show a red warning page in Chrome and your search rankings will be suppressed. This makes quick cleanup critical.
13. When to Restore From Backup Instead
Sometimes restoring from a clean backup is faster than manually hunting through infected files, especially if the infection is widespread. This makes sense when:
- You have a recent backup from before the infection
- The infection has touched dozens or hundreds of files
- You're not comfortable with SSH and file-level investigation
- The database has been heavily modified
You can restore from a cPanel backup (if you have one), from an UpdraftPlus backup, or ask our support team to check if server-level backups are available. After restoring, immediately update everything and change all passwords so the same vulnerability doesn't get exploited again.
For details on backup options, see our guide: How to Back Up Your Website.
Need Professional Help?
Dealing with a hacked site is stressful. Our team can clean the infection, remove backdoors, harden your site, and submit Google review requests for you.
Get WordPress ConsultationQuick Recap: Emergency Cleanup Order
- Change all passwords immediately - WordPress, cPanel, FTP, database, email
- Check Imunify360 in cPanel for auto-detected threats and clean them
- Reinstall WordPress core and delete/reinstall plugins and themes
- Search for backdoors - check uploads for PHP files, scan for eval/base64 patterns, check cron jobs
- Update everything, regenerate security keys, and harden - then install BBQ Firewall and set up backups to prevent it from happening again
Last updated March 2026 · Browse all WordPress articles
