How to Fix a Hacked WordPress Site: A Complete 12-Step Recovery Guide

By · December 1, 2026
How to Fix a hacked WordPress website? How to Fix a hacked WordPress website with our professional malware removal service.

Has your WordPress website been hacked? Are visitors being redirected to suspicious websites, unfamiliar administrator accounts appearing in your dashboard or Google displaying security warnings?

A compromised WordPress website requires more than simply removing a suspicious file or installing a security plugin. Successful recovery involves identifying the infection, preserving legitimate website content, removing malicious components, addressing vulnerabilities and verifying that your website functions correctly.

To fix a hacked WordPress site, follow these essential steps:

  1. Contain the security incident.
  2. Document suspicious activity.
  3. Create a complete website backup.
  4. Secure administrative access.
  5. Perform a malware scan.
  6. Investigate and repair compromised WordPress files.
  7. Examine the WordPress database.
  8. Investigate hidden backdoors.
  9. Identify the likely source of the compromise.
  10. Implement security hardening.
  11. Verify website functionality and security.
  12. Address Google security warnings and establish ongoing monitoring.

This guide explains each step in detail, including common mistakes that can lead to data loss or recurring malware infections.

If you prefer professional assistance, HostInsightPro offers a WordPress malware removal and security hardening service for $499 per eligible website.

How Do You Know If Your WordPress Website Has Been Hacked?

Not every compromised WordPress website displays obvious signs of an infection. Some malicious activity occurs in the background while the website continues functioning normally.

The following symptoms may indicate a security compromise.

Warning sign Potential security issue
Website redirects visitors to spam Redirect malware
Unknown administrator accounts Unauthorized access
Unfamiliar pages appear in Google SEO spam infection
Security plugins become disabled Unauthorized configuration changes
Hosting provider suspends your website Detected malicious activity
Google displays security warnings Malware or phishing content
Website files repeatedly change Persistent compromise
Unexplained server resource usage Unauthorized scripts or other activity
Unexpected advertisements appear Injected malicious content
Administrator password suddenly stops working Possible account compromise

These symptoms do not always indicate malware. Software conflicts, hosting problems and configuration errors can produce similar behavior.

However, multiple unexplained symptoms warrant a thorough security investigation.

What Should You Do Immediately After Your WordPress Site Gets Hacked?

If your website has been compromised, avoid making rushed changes that could destroy important evidence or damage legitimate website functionality.

Do not immediately delete unfamiliar files, reinstall your entire website or restore an unverified backup.

Instead, focus on protecting visitors, preserving your website and establishing the extent of the security incident.

Step 1: Contain the Security Incident

If your website is distributing malware, redirecting visitors to dangerous pages or collecting information through unauthorized forms, temporarily restricting public access may be necessary.

Contact your hosting provider and explain the symptoms you have observed.

Depending on your hosting environment, containment options may include:

  • Temporarily restricting public website access.
  • Using hosting-level access controls.
  • Isolating the affected website from other installations.
  • Temporarily disabling compromised functionality.
  • Restricting unauthorized administrative access.

A standard WordPress maintenance mode plugin may not be sufficient if malicious activity occurs outside normal WordPress page processing.

If you operate an e-commerce website and suspect that customer information or payment data has been compromised, contact your payment processor and an appropriately qualified incident-response specialist.

A standard malware cleanup may not be sufficient for incidents involving sensitive customer information.

Step 2: Document the Security Incident

Before making significant changes, gather information about the compromise.

Create a record containing:

  • The date you first noticed suspicious activity.
  • Affected website URLs.
  • Screenshots of unusual behavior.
  • Malware scanner notifications.
  • Hosting provider security alerts.
  • Recently installed or updated plugins.
  • Unfamiliar administrator accounts.
  • Available website access and error logs.

Documentation helps establish a timeline and may assist with identifying how the website was compromised.

For example, if malicious files appeared shortly after an outdated plugin received unusual requests, that information may help guide the investigation.

It does not necessarily prove that the plugin caused the compromise, but it provides a useful starting point.

Step 3: Create a Complete WordPress Backup

Before attempting malware removal, preserve a complete copy of your website.

A WordPress website consists of both website files and a database. Backing up only one of these components may prevent you from fully restoring the website later.

Your backup should include:

Backup component Purpose
WordPress core files Preserve the existing installation
wp-content directory Preserve themes, plugins and media
WordPress database Preserve content, users and settings
wp-config.php Preserve essential configuration
Server configuration files Preserve relevant website settings
Available access and error logs Support security investigation

Depending on your hosting provider, you may be able to create a complete backup using:

  • cPanel Backup Wizard.
  • Your managed hosting dashboard.
  • SFTP file downloads and database exports.
  • Hosting snapshots.
  • Trusted backup software.

If you use phpMyAdmin to export your database, remember that this does not back up your website files.

Similarly, downloading the wp-content directory does not preserve database content.

Important: A backup created after your website has been compromised may contain malware. Keep it isolated from publicly accessible websites and do not assume it represents a clean recovery point.

Step 4: Secure Administrative Access

A compromised administrator account can allow an attacker to continue modifying your website during the cleanup process.

From a trusted device, secure your hosting account, administrative email account and other relevant access mechanisms.

If WordPress administrator access remains available, navigate to Users → All Users.

Review:

  • Administrator accounts you do not recognize.
  • Unexpected changes to user roles.
  • Unfamiliar email addresses.
  • Accounts belonging to former employees or contractors.
  • Unnecessary administrative privileges.

Preserve relevant evidence before removing or disabling unauthorized accounts.

If you are locked out of WordPress, contact your hosting provider for assistance recovering authorized access.

Avoid relying solely on WordPress password changes if the compromise may involve hosting credentials or malicious files. Additional credential rotation should take place after cleanup to reduce the risk that new credentials are captured by remaining malware.

How to Remove Malware From a Hacked WordPress Website

Once the incident has been contained and your website has been backed up, begin investigating the affected components.

Step 5: Perform a Comprehensive WordPress Malware Scan

A reputable security plugin can help identify suspicious files, modified software and known vulnerabilities.

Wordfence is one commonly used WordPress security tool.

If you can safely access the WordPress dashboard:

  1. Navigate to Plugins.
  2. Install Wordfence from the official WordPress plugin repository if appropriate.
  3. Activate the plugin.
  4. Open the Wordfence scanning interface.
  5. Start a security scan.
  6. Review the reported findings.

Depending on your configuration, the scan may identify:

  • Modified WordPress core files.
  • Suspicious PHP files.
  • Potentially malicious code.
  • Outdated plugins and themes.
  • Known software vulnerabilities.
  • Unauthorized file modifications.

Should You Delete Every File Wordfence Identifies?

No. Some security findings may involve legitimate customizations or unfamiliar but harmless software.

Before deleting a suspicious file, determine its purpose, whether it belongs to a legitimate software package and whether it can be safely replaced.

Preserve a copy of confirmed malicious files when appropriate for investigation.

A security scanner is an important investigation tool, but its findings require interpretation.

Step 6: Investigate and Repair Compromised WordPress Files

WordPress infections can affect several parts of the website installation.

Use your hosting file manager, SFTP client or an appropriate administrative tool to investigate suspicious files.

The following locations deserve particular attention.

File or directory Reason for inspection
wp-admin/ WordPress administrative core files
wp-includes/ WordPress core functionality
wp-content/plugins/ Plugin integrity and unauthorized modifications
wp-content/themes/ Theme integrity and injected content
wp-content/uploads/ Unexpected executable files
wp-content/mu-plugins/ Automatically loaded plugins
wp-config.php Unauthorized configuration changes
.htaccess Unexpected server rules on supported servers
.user.ini Unauthorized PHP configuration changes where applicable
index.php Unexpected modifications to website entry files

The presence of a file in one of these locations does not automatically mean it is malicious.

Verify WordPress Core File Integrity

Website administrators with authorized SSH access and WP-CLI installed can use the following command from the appropriate WordPress directory:

wp core verify-checksums

This compares WordPress core files against official checksums for the installed version.

Plugin integrity can also be investigated using:

wp plugin verify-checksums --all

Plugin checksum verification is limited to software for which applicable checksums are available. Premium plugins, custom plugins and some other components may require separate manual comparison.

Run administrative commands from an appropriately trusted environment. Avoid executing compromised WordPress software unnecessarily during an active incident.

Replace Compromised Components Carefully

Where appropriate, replace modified WordPress core files, plugins and themes with trusted copies.

Download software directly from WordPress.org or the legitimate software developer.

Simply overwriting existing files may leave unauthorized files behind. A controlled replacement or clean rebuild may be necessary for affected directories.

Preserve legitimate customizations and test website functionality after each significant change.

Do not delete the entire wp-content directory unless you have a properly planned recovery procedure. This directory may contain your website’s themes, media and important plugin components.

Step 7: Investigate the WordPress Database

A hacked WordPress website may continue exhibiting malicious behavior even after compromised files have been repaired.

This can happen when unauthorized content or settings exist in the database.

Depending on your hosting environment, phpMyAdmin may provide access to the WordPress database.

Common areas of investigation include:

Database table Potential issue to investigate
wp_options Unauthorized settings or redirects
wp_posts Injected scripts, spam pages or altered content
wp_postmeta Unauthorized content or metadata
wp_users Unfamiliar user accounts
wp_usermeta Unauthorized privileges or account changes

Your WordPress installation may use a different table prefix instead of wp_.

Review relevant entries for unauthorized changes associated with the infection.

Database cleanup requires particular care because some WordPress and plugin settings contain serialized data. Incorrect manual edits or indiscriminate search-and-replace operations can damage website functionality.

Always preserve a database backup before making changes.

If you are not comfortable working directly with database content, consider professional assistance.

Step 8: Investigate Hidden Backdoors and Persistent Malware

Removing the most obvious malware does not necessarily mean your WordPress website has been fully recovered.

A backdoor can provide unauthorized access even after visible malicious content has been removed.

Potential indicators of persistent compromise include:

  • Deleted malicious files reappearing.
  • Administrator accounts being recreated.
  • Recurring unauthorized redirects.
  • Unexpected scheduled tasks.
  • Repeated changes to legitimate software.
  • Malware returning shortly after a backup restoration.

Investigate suspicious scheduled tasks, automatically loaded plugins, administrative access and unexpected file modifications.

Also determine whether other websites sharing the same hosting account may be affected.

Your hosting provider may need to investigate scheduled jobs, server-level configuration or other components outside WordPress.

Read our WordPress backdoor removal guide for additional information about persistent infections.

How Did Your WordPress Website Get Hacked?

Understanding how the website was compromised can help reduce the likelihood of another infection.

Step 9: Identify the Likely Source of the Compromise

Common contributing factors include outdated software, compromised credentials, vulnerable plugins, untrusted themes and insecure hosting configurations.

Review the following areas.

Outdated WordPress Plugins

Check installed plugins for available updates and publicly documented security vulnerabilities.

Pay particular attention to software that has not received maintenance or security updates.

A plugin with a known vulnerability is not automatically responsible for the compromise, but it should be investigated and appropriately secured.

Compromised Administrator Accounts

Review available login records and administrative activity.

Unexpected login locations, unfamiliar devices or unauthorized changes may help identify compromised accounts.

However, location and IP information alone do not establish an attacker’s identity.

Website Access Logs

Hosting access logs may reveal unusual requests associated with suspicious activity.

Review available records around the period when the infection was first detected.

Correlate relevant requests with file modifications, security alerts and software vulnerabilities.

If historical logs are unavailable, determining the original attack vector may not be possible.

Untrusted Plugins and Themes

Software downloaded from unofficial sources can introduce security risks.

Remove unnecessary or untrusted software after preserving relevant evidence and confirming that removal will not damage essential functionality.

Other Infected Websites

If your hosting account contains multiple websites, determine whether additional installations show signs of compromise.

Cleaning one website may not be enough when the underlying security problem affects the broader hosting environment.

The objective is to address documented vulnerabilities and likely contributing factors without making unsupported claims about how the incident occurred.

How to Secure Your WordPress Website After Malware Removal

Step 10: Implement WordPress Security Hardening

Security hardening reduces unnecessary exposure to common threats.

After addressing identified malicious components, implement appropriate security improvements.

Security measure Purpose
WordPress core updates Address known core vulnerabilities
Plugin and theme updates Reduce software-related security risks
Web application firewall Filter suspicious web traffic
Two-factor authentication Strengthen account protection
Brute-force protection Reduce repeated login attempts
Administrator account review Remove unnecessary privileges
Dashboard file editing restrictions Restrict administrative code editing
File permission review Reduce unnecessary filesystem access
Automatic update configuration Improve timely patch deployment
Secure backups Support future recovery
Credential rotation Reduce risk from previously compromised access

Disable WordPress Dashboard File Editing

One common hardening measure is disabling the built-in theme and plugin file editors.

This can be configured by adding the following setting to wp-config.php in the appropriate location before WordPress is loaded:

define( 'DISALLOW_FILE_EDIT', true );

Back up the configuration file before editing it, and check whether the setting already exists.

This measure disables the built-in file editors but does not prevent every possible method of modifying website files.

Configure Two-Factor Authentication

Two-factor authentication adds another layer of protection to administrator accounts.

A security plugin such as Wordfence can provide this functionality.

Where supported, enable two-factor authentication for administrative users and securely preserve account recovery codes.

Rotate Credentials and Invalidate Old Sessions

Following cleanup, rotate relevant passwords and access credentials from a trusted device.

Consider WordPress accounts, hosting accounts, SFTP access and database credentials where appropriate.

Changing WordPress authentication salts can invalidate existing WordPress login cookies. Ensure legitimate administrators are aware that they may need to log in again.

Coordinate database password changes with wp-config.php to avoid breaking database connectivity.

Establish Reliable Backups

Configure regular backups according to how frequently your website changes.

A busy WooCommerce website may require more frequent backups than a static business website.

Store recovery copies separately from the production website where possible and periodically test your ability to restore them.

How to Verify That Your Hacked WordPress Site Is Clean

Step 11: Perform Post-Cleanup Security and Functionality Testing

After removing identified malware and implementing security improvements, verify that the website behaves as expected.

Perform a follow-up malware scan and investigate any remaining suspicious findings.

Check website functionality, including:

  • Homepage and internal pages.
  • WordPress administrator login.
  • Navigation and menus.
  • Contact forms.
  • Mobile responsiveness.
  • Customer account access.
  • Shopping cart and checkout functionality, where applicable.
  • Website redirects.
  • Important third-party integrations.

Clear relevant website, hosting and CDN caches so outdated cached content does not interfere with testing.

Also review available logs and monitor for recurring suspicious file modifications or administrative changes.

A clean malware scan is encouraging, but it does not guarantee that every possible malicious component has been identified.

If suspicious activity continues, additional investigation may be required.

Step 12: Address Google Security Warnings and Monitor Your Website

Google may display warnings when it detects harmful content on a website.

After completing malware removal, sign into Google Search Console and review Security & Manual Actions → Security Issues.

If a security issue is listed:

  1. Review the reported problem and example URLs.
  2. Confirm that the underlying issue has been addressed across the affected website.
  3. Verify that malicious pages or content are no longer accessible.
  4. Request a security review where the option is available.
  5. Monitor Search Console for updates.

Google controls its security review process. A website cleanup provider cannot guarantee when security warnings will disappear.

Read our guide on fixing the WordPress deceptive site ahead warning for additional information.

Continue monitoring your website after recovery and address newly identified security vulnerabilities promptly.

Should You Restore a Backup or Manually Clean a Hacked WordPress Site?

Restoring a website from a backup may be faster than investigating and repairing every compromised component individually.

However, it introduces important considerations.

Recovery method Advantage Limitation
Restore a verified clean backup Potentially faster recovery May lose recent website content
Manual malware removal Can preserve recent changes Requires careful investigation
Clean WordPress rebuild Replaces compromised software Requires additional migration and testing
Professional cleanup Provides structured technical assistance Requires a financial investment

Restoring a backup is most appropriate when you have a reliable recovery copy created before the compromise and can address the original security weakness before returning the website to normal operation.

For an online store, restoring an older database may remove recent orders, customer registrations or inventory changes.

Evaluate the potential data loss before performing a complete restoration.

Common Mistakes When Fixing a Hacked WordPress Website

Avoid these common recovery mistakes:

Deleting Every Suspicious File

Some unfamiliar files are legitimate software components. Deleting them without investigation can break your website.

Assuming One Clean Scan Is Enough

Automated scanners have limitations. Functional testing, manual investigation and monitoring provide additional confidence.

Ignoring the Original Security Weakness

Removing malware without addressing vulnerable software or compromised access may result in reinfection.

Restoring an Infected Backup

A backup created after the original compromise may contain the same malicious components.

Ignoring Other Websites on the Hosting Account

Additional compromised installations may require separate investigation.

Returning the Website to Production Too Early

Verify that harmful behavior has stopped before restoring unrestricted public access.

Failing to Maintain the Website After Cleanup

Regular updates, monitoring, secure backups and administrative access reviews remain important after recovery.

How Much Does It Cost to Fix a Hacked WordPress Site?

The cost depends on the size of the website, severity of the infection and amount of investigation required.

Free security tools may be sufficient for certain straightforward infections, while recurring or extensive compromises may require professional assistance.

HostInsightPro offers a standard $499 WordPress malware removal service for one eligible website.

Our package includes:

  • Website and database backup.
  • Malware scanning and manual investigation.
  • Removal of identified malicious content.
  • Database security review.
  • Common backdoor investigation.
  • Vulnerability assessment.
  • WordPress security hardening.
  • Post-cleanup verification.
  • Final written security report.

Complex server-level compromises, multiple affected websites and advanced forensic investigations may require a separate assessment.

For more information, read our WordPress malware removal cost guide.

Frequently Asked Questions

Can a hacked WordPress website be recovered?

Yes. Many compromised WordPress websites can be recovered through malware removal, controlled restoration or replacement of affected software. Recovery options depend on the severity of the incident and availability of reliable backups.

Can I fix a hacked WordPress site myself?

Yes, if you have sufficient technical knowledge, administrative access and reliable backups. Professional assistance may be appropriate when the compromise involves unfamiliar malicious code, database infections or recurring malware.

Does reinstalling WordPress remove malware?

Reinstalling WordPress core files may resolve infections affecting those files. However, it does not necessarily remove malicious components from plugins, themes, databases or hosting configurations.

Will Wordfence fix my hacked website?

Wordfence can help detect and remediate certain infections. Additional investigation may be necessary for malware that persists outside its detection capabilities.

Can I fix a hacked website without losing data?

In many cases, legitimate website content can be preserved through controlled remediation. However, some damaged or compromised components may require restoration or replacement.

Why does my WordPress website keep getting hacked?

Recurring infections may result from unresolved vulnerabilities, hidden backdoors, compromised credentials or other affected websites.

Read our guide on why WordPress websites keep getting hacked.

Can a hacked WordPress website damage my SEO?

Yes. Unauthorized redirects, spam pages and browser security warnings can affect organic traffic and visitor confidence. Removing malware may help address these problems, but previous rankings cannot be guaranteed.

Should I contact my hosting provider if my website gets hacked?

Yes, particularly if the infection affects hosting access, multiple websites or server-level components. Your hosting provider may also have useful security logs and recovery options.

How long does it take to fix a hacked WordPress website?

Recovery time varies according to the severity of the infection, website complexity, access availability and amount of testing required. An initial assessment is necessary to establish a realistic timeframe.

Can I prevent my WordPress website from ever getting hacked again?

No security solution can guarantee permanent protection. Regular updates, strong authentication, firewalls, reliable backups and ongoing monitoring can significantly reduce common security risks.

Get Professional Help Fixing Your Hacked WordPress Site

Recovering a compromised website can be time-consuming, particularly if malware affects multiple files, database content or administrative access.

Attempting unfamiliar technical repairs on a live business website can also introduce additional problems.

HostInsightPro offers professional WordPress malware investigation, cleanup and security hardening for a standard one-time price of $499 per eligible website.

Our objective is to remove identified malicious content, address discovered security weaknesses and verify important website functionality.

You also receive a written security report documenting the work performed and recommended next steps.

Get your website back under your control.

Request professional WordPress malware removal today.

Provide your website URL, a description of the security problem and any relevant security alerts. Do not include passwords in your initial inquiry.

References and Additional Resources