Blog · Security

How to Fix a Hacked WordPress Site: Cleanup and Recovery Steps

Nov 30, 2026By Vladimir Mrkela
Share LinkedInX
How to Fix a Hacked WordPress Site: Cleanup and Recovery Steps

WordPress gives site owners a flexible way to publish content and run online services, but that flexibility also means a breach can affect more than a website’s appearance.

A hacked site may put visitor information, payments, and the site’s reputation at risk, so a quick, careful recovery matters.

Understanding how to fix a hacked WordPress site can help you limit the damage and restore trust.

Here’s how to approach cleanup and recovery.

Secure Your Hacked WordPress Site

Before you remove malware or restore files, limit what an attacker can do: put your site in maintenance mode if possible, change your hosting and WordPress passwords from a clean device, and ask your host to scan the server and block suspicious access.

Reduce visitors’ risk

If you can’t take the site offline, disable forms, checkout, and other features that collect personal or payment details.

Add clear user warnings if visitors might encounter suspicious pages, and don’t claim the site is safe until you’ve checked it.

Check what’s happening

Review hosting logs and use traffic analysis to spot unusual requests, repeated login attempts, or unexpected spikes.

Share the time and patterns with your host so they can help block harmful activity. Keep a record of changes you make, including when you enable maintenance mode.

Avoid deleting files or restoring backups yet, since those steps belong to cleanup and recovery. Keep access limited while you assess the incident.

Reset Passwords and Revoke Access

With suspicious activity contained, reset passwords from a clean device and remove access the attacker could still use. Start with administrator accounts, then secure every account tied to your site.

A password reset won’t protect you if someone keeps an active login or recovery route.

  1. Change passwords for WordPress admins, hosting, your database, and related email accounts. Use unique, long passwords, and store them in a password manager. Update shared credentials, too.
  2. Sign out all WordPress users, then review the user list. Remove unknown accounts, lower unnecessary administrator roles, and ask trusted users to choose new passwords.
  3. Revoke access to connected services. Remove unfamiliar application passwords, API keys, and active sessions; rotate legitimate keys that could expose your site. Check hosting and domain access, and enable two-factor authentication where available.

Record who still needs access, so you can review permissions later. Don’t reuse old passwords.

Track who still needs access for later permission reviews, and never reuse an old password.

If a service supports session controls, use them to end existing logins immediately. This access revocation limits further changes while you continue recovery.

Find Out How the Hack Happened

How did the attacker get in? Start by building an attack timeline, using the first sign of trouble, such as a changed file, redirect, or unfamiliar admin account. Compare that date with your hosting logs, WordPress activity records, and security alerts. Note when suspicious logins or file changes began.

Next, look for the entry point. Check for unknown administrator accounts, outdated plugins or themes, and extensions you don’t recognize. Review access logs for repeated login attempts, unusual locations, or requests to vulnerable files. Ask your host to check server logs if you can’t access them.

Write down what you find, including dates, affected accounts, and suspicious components. Don’t assume the first visible change marks the start of the attack. A clear timeline can help you identify what needs fixing and reduce the chance of the same weakness being used again.

Back Up Your Hacked Site Safely

Before you clean your hacked site, make a backup so you can preserve a clean copy of its files and database.

Store it somewhere separate from your hosting account, such as an encrypted drive you control.

Don’t treat the backup as clean until you’ve checked it for malware.

Preserve a Clean Copy

Save a copy of your hacked WordPress site before you change anything, so you can recover important files or investigate how the breach happened. Keep this copy separate from the files you’ll clean, and label it clearly as a record of the infected site.

  1. Capture the full site: Export your database and copy WordPress files, including uploads, themes, and plugins. Note the date and time.
  2. Preserve evidence: Don’t edit, delete, or run cleanup tools on this copy. Record suspicious file names and unusual account activity separately.
  3. Create a clean reference: If you have a known-good backup from before the attack, keep it as a baseline snapshot. Compare it with the hacked copy to spot changes.

Call this trusted version your Pristine archive, and confirm it predates the breach before relying on it for restoration. You’ll need both copies to investigate and recover without losing useful data.

Store Backups Securely

Keep the infected-site copy and any clean reference backup in a secure location separate from your web server. That separation helps prevent malware or an attacker from reaching every copy.

Store the files on an encrypted external drive or in trusted offsite storage, such as a protected cloud account. Use a strong, unique password, and turn on multifactor authentication for any online account.

Label each backup with its date and status, such as “infected—investigation copy” or “clean—pre-incident.” Don’t overwrite the infected copy; you may need it to identify how the breach happened. Keep access limited to people helping with recovery.

Encrypted backups protect files if someone steals the storage device or account. Test a copy by restoring it in a separate, isolated environment before you rely on it.

Scan Your WordPress Site for Malware

Choose a trusted malware scanner that works with your hosting setup. Run it against your WordPress files and database, since threats can hide in either place.

Review the results carefully, and note flagged items before you remove or change anything.

Choose a Malware Scanner

A malware scanner can help you find suspicious files, injected code, and other signs of a hack, but no single tool catches everything. Choose a scanner that fits your access, budget, and technical comfort.

Compare its detection features, update history, and plugin compatibility before you install it. A scanner that conflicts with your security or caching plugins may cause errors, so check its guidance first.

  1. Review detection coverage. Look for checks for known malware, changed files, and suspicious code, but don’t treat results as proof that your site is clean.
  2. Check access needs. Some tools run as WordPress plugins, while others scan from an external service or through your host.
  3. Confirm support. Choose a tool with clear instructions and recent updates, then contact your host if you’re unsure which option is safe for your site.

Scan Files and Database

Before you remove anything, scan your WordPress files and database for suspicious code, unfamiliar admin accounts, and unexpected changes.

Run the malware scanner you selected across your full site, not just the public pages. Include WordPress core files, themes, plugins, uploads, and database tables. If the tool offers a deep scan, enable it, then let the scan finish without editing files.

Check that File integrity monitoring compares core files with clean versions from the same WordPress release. Your scan should also cover database anomalies, such as injected links, unfamiliar scripts, or altered settings. Ask your host to scan server files too, since some threats may sit outside your WordPress folder.

Record the scan date and affected areas. Don’t delete, replace, or clean anything yet; preserve the current state so you can assess findings and plan safe repairs.

Review Scan Results

Once the scan finishes, review each finding before making changes, since some alerts may be false positives or point to outdated files rather than malware.

Check the file path, detection details, and last modified date. Compare suspicious files with clean WordPress, theme, or plugin copies before removing anything.

  1. Sort by scan severity. Address confirmed malware and unknown administrator accounts first, then review warnings and outdated software. A high rating deserves attention, but it doesn’t prove a file is infected.
  2. Verify each alert. Look for unfamiliar code, unexpected redirects, or files in unusual folders. Check trusted scanner guidance, and don’t delete core or plugin files until you’ve confirmed they’re malicious.
  3. Record your findings. Save the report, note affected paths, and mark items you’ve verified. If you’re unsure, quarantine the file or ask a security professional before editing it.

Rescan after cleanup to confirm the alerts are gone.

Remove Malware and Unauthorized Changes

Remove malware only after you’ve identified how the attacker got in and saved a clean backup for reference. Use your scan results to locate infected files, suspicious admin accounts, injected scripts, and altered pages. For malicious code removal, delete only confirmed threats, and don’t edit unfamiliar files without checking their purpose. Change compromised passwords and remove unauthorized accounts.

Finding Action
Injected script Remove it, then check the affected file
Unknown admin Remove the account and review its changes

Review posts, pages, menus, and settings for changes the attacker made. Use unauthorized content restoration to remove spam links, restore altered text, and correct redirects. Check each affected page in a private browser window. If you’re unsure whether a change is malicious, compare it with your notes or ask a WordPress security professional before removing it. Keep a record of your cleanup actions.

Restore Clean WordPress Files and Data

Restore WordPress from clean, trusted copies rather than files that may still contain malware. Use a backup from before the attack, and confirm it’s complete and compatible with your current hosting setup.

If you don’t have a safe backup, replace affected files with fresh copies from WordPress.org and your trusted plugin and theme sources.

  1. Replace core files: Perform WordPress core restoration by uploading clean core files. Keep wp-config.php and wp-content only after checking that you need them and they’re clean.
  2. Restore themes and plugins: Reinstall them from trusted sources, then restore custom changes from a verified backup.
  3. Restore the database: Import a clean database backup, then run database integrity checks to confirm tables and content load correctly. Review recent posts and settings before reopening the site. Keep a copy of the cleaned files and database for recovery.

Check for Backdoors and Reinfection

Clean files and a verified database can still hide a backdoor, such as a secret admin account or altered plugin file. Review every administrator in your dashboard, remove accounts you can’t verify, and check recent file changes against clean copies. Look for unfamiliar scheduled tasks and suspicious code.

Check What to look for Next step
Users Hidden admin accounts Remove unknown users
Files Changed plugin files Replace clean copies
Tasks Malicious cron jobs Delete unknown jobs

Search uploads for PHP files, since attackers may hide scripts there. Ask your host to scan server logs for repeated access to suspicious files. Then review the site again after a few days. If unfamiliar files or users return, don’t simply delete them again, contact your host to trace the entry point and clean related accounts.

Harden WordPress Against Future Attacks

Once you’ve confirmed the site is clean, tighten its security to reduce the chance of another attack. A few steady habits can make WordPress security hardening part of your routine, not a one-time fix.

  1. Update and remove. Keep WordPress, themes, and plugins current, and delete anything you don’t use. Choose extensions from trusted sources, and replace unsupported tools.
  2. Limit access. Give each person an individual account with only the permissions needed. Use strong, unique passwords and enable two-factor authentication, especially for administrator accounts. Remove former users promptly.
  3. Monitor and back up. Set up ongoing threat monitoring through a reputable security plugin or host, and review alerts and login activity. Schedule automatic backups, store copies off-site, and test a restore so you know it works.

These steps won’t prevent every attack, but they’ll help you spot problems sooner and recover with less disruption.

Frequently Asked Questions

How Can I Tell Whether My WordPress Site Has Actually Been Hacked?

You can spot a hack through unfamiliar admin accounts, changed files, unexpected redirects, or security alerts. Check Suspicious File Changes and use Malicious Redirect Detection. If you find evidence, treat your site as compromised and investigate promptly.

Should I Notify Customers if Hackers Accessed Their Personal Information?

Yes—Notify Customers promptly if hackers accessed their personal information. You should also review applicable Reporting Requirements, since laws may mandate notices to affected people, regulators, or both. Consult qualified legal counsel to determine your specific obligations and deadlines.

Can a Hacked WordPress Site Harm My Search Rankings or Online Reputation?

Yes, a hacked WordPress site can lower your search rankings and damage your online reputation. Remove malicious content quickly, secure your site, and request reindexing. Search result reputation recovery and brand trust rebuilding take consistent effort.

When Should I Contact My Hosting Provider About a WordPress Hack?

Contact your hosting provider as soon as you suspect a WordPress hack, especially if you can’t access your site, detect malware, or see suspicious traffic. Request Hosting Provider Incident Reports and Shared Server Isolation immediately to limit damage.

How Long Does WordPress Hack Recovery Typically Take?

Typical recovery timeline: You may restore a simple hacked WordPress site within hours, but complex infections can take days. Cleanup time estimates depend on damage, backups, hosting support, and whether attackers left hidden access or reinfected your site.

Conclusion

After cleanup, don’t assume your WordPress site is safe just because it looks normal. Keep monitoring for unfamiliar users, files, redirects, and security alerts. Update WordPress, plugins, and themes, remove anything you don’t use, and use unique passwords with two-factor authentication. Keep tested backups stored away from your hosting account so you can restore a clean copy if needed. If malware returns or you can’t confirm the site is clean, ask a qualified WordPress security professional to review it.

Tags
  • Malware Removal
  • Website Recovery
  • WordPress security

About the author

Vladimir Mrkela

Vladimir Mrkela

Senior WordPress Developer

I’m a senior WordPress developer and co-founder of Pixel Industry. I’ve spent more than 12 years building websites, custom plugins, and integrations for all kinds of projects. I enjoy working on complex architecture, solving tricky problems, and sharing what I learn along the way.

Ready to build?

Have a WordPress project that needs expert judgment?

Get a Free ConsultationTell us about your project and we will get back to you soon.