WordPress Malware Removal: How to Clean a Hacked Site

WordPress Malware Removal: How to Clean a Hacked WordPress Website Safely

A hacked WordPress website rarely tells the whole story from the homepage.

You may notice a strange redirect, unwanted pages, suspicious advertisements, unfamiliar administrator accounts or a warning from Google. In other cases, the website may appear completely normal while malicious code remains hidden inside files, the database or another part of the hosting environment.

That is why WordPress malware removal should not begin with deleting the first suspicious file you find.

A proper cleanup should establish what was affected, remove malicious code and persistence mechanisms, restore legitimate components, secure compromised accounts and verify that the infection is actually gone.

The goal is not simply to make the homepage look normal again. The goal is to return the website to a trustworthy state.

What Is WordPress Malware?

WordPress malware is malicious code, content or unauthorized functionality introduced into a WordPress website or its supporting environment.

It can appear in PHP files, plugins, themes, uploaded files, configuration files, scheduled tasks, database records or compromised user accounts.

The visible symptom depends on what the attacker is trying to achieve.

  • Redirecting visitors to unwanted websites
  • Creating spam pages
  • Injecting malicious links
  • Displaying unwanted advertisements
  • Creating unauthorized administrator accounts
  • Maintaining hidden access to the website
  • Stealing information
  • Manipulating website content
  • Using the website for phishing
  • Using the website to distribute malicious content

A single infection can also contain more than one component. Removing the visible symptom without investigating the underlying access path can therefore result in reinfection.

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

Some compromises are obvious. Others are deliberately designed to remain difficult to notice.

Common warning signs include:

  • Visitors are redirected to an unrelated website.
  • Unexpected pages appear in search results.
  • Unknown administrator accounts appear in WordPress.
  • Plugins or themes appear that nobody installed.
  • Website content changes without authorization.
  • Suspicious PHP files appear in the installation.
  • Google displays a security warning.
  • The hosting provider suspends the website.
  • Users report strange pop ups or redirects.
  • The website suddenly behaves differently for mobile visitors.
  • Unexpected outbound links appear.
  • The website becomes unusually slow.

These symptoms are useful indicators, but none of them alone proves exactly what happened.

A professional investigation should distinguish between an observed symptom and a confirmed compromise.

Do Not Start by Deleting Random Files

When a website owner discovers malware, the first instinct is often to search for suspicious code and delete it.

This can make the situation worse.

A legitimate WordPress file may look unfamiliar to someone who did not create the website. A malicious file may also be connected to another component that restores it later.

Deleting files without understanding their role can cause website errors, remove useful evidence or leave the actual persistence mechanism untouched.

A safer process begins with preservation, investigation and controlled remediation.

Step 1: Preserve the Current State

Before making significant changes, preserve the current state of the website where practical and appropriate.

This may include:

  • Website files
  • Database
  • Hosting logs
  • Web server logs
  • Security plugin reports
  • Relevant screenshots
  • Suspicious URLs
  • Known malicious files
  • WordPress administrator information

A backup taken before cleanup provides a recovery point and can also preserve evidence that may become unavailable after files or database records are changed.

The backup itself should be protected from unauthorized modification and should not simply be treated as a clean copy.

Step 2: Determine the Scope of the Infection

The next question is not simply “Where is the malware?”

The more important question is:

“How much of the website may have been affected?”

The investigation should consider several areas of the WordPress environment.

AreaWhat to Review
WordPress coreModified or unexpected core files.
PluginsUnknown, outdated or modified plugins.
ThemesUnexpected code or modified theme files.
UploadsUnexpected executable or suspicious files.
DatabaseInjected content, options and suspicious records.
UsersUnknown or unauthorized accounts.
ConfigurationUnexpected changes affecting website behavior.
Scheduled tasksUnexpected jobs that may recreate malicious activity.

The exact scope depends on the type of compromise and the available evidence.

Step 3: Scan the Website

Malware scanning can help identify suspicious files, modified components and other indicators of compromise.

A useful scan may examine:

  • WordPress core files
  • Plugin files
  • Theme files
  • Uploaded files
  • Configuration files
  • Database content
  • Administrator accounts
  • Known malicious patterns

However, a scan should be treated as evidence rather than a guarantee.

Different scanners use different detection methods. A clean result from one scanner does not necessarily prove that every malicious component has been removed.

For a serious compromise, scanner results should be considered alongside file integrity, database inspection, account review, configuration analysis and website behavior.

Step 4: Compare WordPress Core Files With Known Good Files

WordPress core files provide an important reference point because legitimate versions can be obtained from the official WordPress project.

If a core file has been modified unexpectedly, replacing it with the correct official version can remove unauthorized changes while restoring the intended WordPress code.

This should be performed carefully because custom modifications or deployment practices may exist on some websites.

The objective is to distinguish legitimate customization from unauthorized modification.

Step 5: Review Plugins and Themes

Plugins and themes deserve particular attention because they extend the WordPress codebase and can introduce additional functionality.

Review:

  • Installed plugins
  • Inactive plugins
  • Installed themes
  • Inactive themes
  • Plugin versions
  • Theme versions
  • Unknown components
  • Components obtained from untrusted sources
  • Unexpected modifications

An inactive plugin is not automatically harmless. If its files remain on the server, they can still be relevant to the security assessment.

Unused components should therefore be reviewed and removed when they are not required.

Step 6: Inspect the Uploads Directory

The WordPress uploads directory normally contains media and other user uploaded content.

Unexpected executable files in locations intended for media should receive careful attention.

The assessment should consider:

  • Unexpected PHP files
  • Unknown archives
  • Recently modified files
  • Files with unusual names
  • Files that do not match the website’s normal content

Not every unusual file is malicious. The file’s purpose, origin and contents should be considered before removal.

Step 7: Inspect the Database

Cleaning the filesystem does not necessarily clean a compromised WordPress website.

Malicious content can also exist inside the database.

Depending on the compromise, relevant areas can include:

  • WordPress options
  • Posts
  • Post metadata
  • User records
  • User metadata
  • Injected JavaScript
  • Unexpected links
  • Suspicious administrative settings

Database cleanup requires particular care because deleting the wrong record can damage legitimate website content or configuration.

Step 8: Check Administrator Accounts

An attacker who obtains administrative access may create another account to maintain access after the original vulnerability is fixed.

Review all privileged accounts and ask:

  • Who owns this account?
  • Is the account still required?
  • Was it created recently?
  • Does the email address belong to the organization?
  • Does the role match the user’s responsibility?
  • Was the account authorized?

Unknown privileged accounts should be treated as a serious finding and investigated before removal when evidence preservation is important.

Step 9: Check for Persistence

One of the biggest mistakes in WordPress malware cleanup is removing the visible infection while leaving behind a mechanism that can recreate it.

Persistence can involve:

  • Malicious files
  • Modified plugins
  • Modified themes
  • Unauthorized administrator accounts
  • Scheduled tasks
  • Injected database content
  • Modified configuration
  • Additional access credentials

This is why a website that looks clean immediately after deleting a suspicious file can become infected again later.

Step 10: Identify the Likely Entry Point

Removing malware addresses the immediate problem. Understanding how the attacker entered helps address the underlying weakness.

Possible entry points can include:

  • Vulnerable plugins
  • Vulnerable themes
  • Outdated WordPress components
  • Compromised administrator credentials
  • Weak hosting credentials
  • Untrusted plugins or themes
  • Exposed management interfaces
  • Compromised third party services

The available evidence may not always prove the exact initial entry point. A professional report should clearly distinguish confirmed evidence from a probable explanation.

Step 11: Remove the Malware Carefully

Once the scope and affected components are understood, remediation can begin.

Depending on the infection, cleanup may involve:

  • Removing malicious files
  • Restoring modified core files
  • Replacing compromised plugins
  • Replacing compromised themes
  • Removing malicious database content
  • Removing unauthorized accounts
  • Removing malicious scheduled tasks
  • Restoring legitimate configuration

There is no universal cleanup command that safely removes every WordPress infection.

The correct remediation depends on what the investigation has found.

Should You Restore a Backup Instead?

A known clean backup can be one of the most useful recovery resources after a compromise.

But a backup should not automatically be restored simply because it is available.

The organization should first determine:

  • When was the backup created?
  • Was the website already compromised at that time?
  • Does the backup contain all required content?
  • Are the plugins and themes current enough?
  • Does the backup include compromised credentials?
  • Could restoring the backup reintroduce the same vulnerability?

A clean backup can restore the website, but it does not automatically fix the vulnerability or compromised credentials that allowed the incident to happen.

Step 12: Rotate Compromised Credentials

If an attacker may have obtained access to the website, changing only the WordPress administrator password may not be enough.

Depending on the environment, review and rotate credentials for:

  • WordPress administrators
  • Hosting control panel
  • FTP or SFTP
  • SSH
  • Database users
  • Application passwords
  • Relevant API credentials

Credentials should be changed through trusted channels and according to the hosting and application architecture.

Step 13: Update WordPress and Vulnerable Components

After cleanup, bring supported WordPress core, plugins and themes to appropriate current versions.

This matters because cleaning the current infection without addressing the vulnerability that allowed the compromise can leave the website exposed to another attack.

WordPress continues to release security updates. For example, WordPress 7.0.4 was released on August 12, 2026 with a security fix, and WordPress 7.0.3 was also a security release. Security updates should therefore be treated as part of normal website maintenance rather than postponed indefinitely.

Step 14: Verify the Cleanup

A cleanup should end with verification.

Check the website again for:

  • Malicious files
  • Unexpected administrator accounts
  • Suspicious plugins
  • Unexpected theme modifications
  • Database injections
  • Malicious redirects
  • Unexpected outbound links
  • Suspicious scheduled tasks
  • Unusual website behavior

Run another appropriate security scan after remediation and compare the results with the initial findings.

The objective is to establish evidence that the identified infection has been addressed, not simply to assume that the site is clean because it looks normal.

What If Google Has Flagged the Website?

A compromised website may lose search visibility or display a security warning to visitors.

Cleaning the website is the first priority. After the underlying security issue has been addressed, website owners can use the appropriate Google Search Console security and manual action workflows to review the site’s status and request reconsideration where applicable.

Do not request a review before the underlying compromise has been properly addressed.

What If the Hosting Provider Suspended the Website?

Hosting providers may restrict compromised websites to protect their infrastructure, other customers or visitors.

If the website has been suspended, first determine what the hosting provider requires for restoration.

  • Malware cleanup report
  • Evidence of remediation
  • Updated software
  • Credential changes
  • Security configuration changes
  • Confirmation that the infection has been removed

Communication with the hosting provider should be part of the recovery process rather than an afterthought.

Why Malware Comes Back After Cleanup

Reinfection is one of the clearest signs that the original cleanup did not address the complete problem.

Common reasons include:

  • The original vulnerability remains.
  • A backdoor was missed.
  • An unauthorized account remains active.
  • A compromised plugin was not replaced.
  • Malicious database content remains.
  • A scheduled task recreates the infection.
  • Hosting credentials were not changed.
  • Another website under the same hosting account remains compromised.

This is why “delete the malware” and “secure the website” should be treated as two different stages of the same recovery process.

WordPress Malware Removal Checklist

StageAction
PreserveCreate a protected backup and preserve useful evidence.
IdentifyConfirm symptoms and affected components.
ScanPerform appropriate malware and integrity checks.
InvestigateReview files, database, users and configuration.
ContainReduce unnecessary access while protecting the website and evidence.
CleanRemove malicious code and unauthorized components.
RestoreReplace compromised legitimate files where appropriate.
SecureChange credentials and address vulnerabilities.
VerifyScan and test the website again.
RecoverAddress hosting and search engine warnings where applicable.
MonitorWatch for reinfection and unexpected activity.

When Should You Stop Trying to Clean the Site Yourself?

DIY cleanup can be reasonable when the website is small, the compromise is well understood and the owner has enough technical knowledge to preserve and restore the environment safely.

Professional assistance becomes more appropriate when:

  • The malware keeps returning.
  • The administrator account has been compromised.
  • The website contains sensitive information.
  • The hosting provider has suspended the site.
  • Google has issued a security warning.
  • The infection affects multiple websites.
  • The database appears compromised.
  • The entry point is unknown.
  • The website contains ecommerce functionality.
  • You cannot establish whether the site is actually clean.

The important question is not whether a website owner can delete suspicious code. It is whether the owner can confidently establish that the compromise has been fully addressed.

What a Professional WordPress Malware Cleanup Should Include

A professional cleanup should provide more than a scanner result.

  • Initial security assessment
  • Backup and evidence preservation
  • Malware identification
  • File integrity review
  • Database inspection
  • Administrator account review
  • Persistence investigation
  • Malware removal
  • Compromised component replacement
  • Credential security review
  • Vulnerability review
  • Post cleanup verification
  • Security hardening recommendations
  • Recovery guidance for hosting or search warnings where applicable

The final report should clearly separate confirmed findings, remediation performed and recommendations for preventing another compromise.

What Cautivra Looks For During a Malware Cleanup

Cautivra approaches WordPress malware removal as a security investigation rather than a simple file deletion task.

The assessment focuses on four questions:

  • What changed?
  • How did the compromise likely happen?
  • What malicious access or persistence remains?
  • What needs to change to reduce the risk of reinfection?

This approach helps avoid the common situation where a website looks clean for a few days and then becomes compromised again.

Final Perspective

WordPress malware removal is not simply about finding suspicious code and deleting it.

A compromised website should be treated as a security incident that requires investigation, controlled cleanup and verification.

The strongest recovery process starts by preserving the current state, identifying the scope of the compromise and examining the website’s files, database, accounts, configuration and other relevant components.

After the malicious components are removed, the work is not finished. Credentials should be reviewed, vulnerable components should be addressed, legitimate files should be restored where necessary and the website should be checked again.

Most importantly, the organization should understand why the compromise happened and what needs to change to reduce the chance of another incident.

A website that looks normal is not necessarily a website that is secure.

Clean the infection. Remove the persistence. Fix the weakness. Verify the result.

Need Professional WordPress Malware Removal?

Cautivra provides remote WordPress malware removal and hacked website recovery for businesses, website owners and organizations dealing with suspicious redirects, malicious code, unauthorized accounts, spam injections and other signs of compromise.

The service focuses on identifying the infection, removing malicious components, reviewing persistence, addressing security weaknesses and verifying the website after cleanup.

Request a WordPress Malware Cleanup

Frequently Asked Questions

Can WordPress malware be removed?

Yes. Many WordPress infections can be removed when the affected files, database content, accounts and persistence mechanisms can be identified and properly remediated. The exact recovery process depends on the nature and scope of the compromise.

Can I remove WordPress malware myself?

Some website owners can perform a cleanup themselves when they have suitable technical knowledge and a reliable recovery process. More complicated infections, repeated reinfections, compromised administrator accounts or hosting and search engine warnings may require professional assistance.

Will restoring a backup remove WordPress malware?

A known clean backup can restore a website, but it should be verified before use. If the backup was created after the compromise, or if the vulnerability and credentials that allowed the attack remain unresolved, restoring it may not solve the underlying security problem.

Why does WordPress malware keep coming back?

Reinfection can occur when the original vulnerability remains, a backdoor or malicious account was missed, compromised credentials were not changed, or another persistence mechanism remains active.

Should I delete a suspicious WordPress file?

Not automatically. A suspicious file should be evaluated in context before removal. Deleting the wrong file can damage the website or remove useful evidence while leaving the actual persistence mechanism untouched.

How long does WordPress malware removal take?

The time depends on the size of the website, the type of infection, the number of affected components, the availability of backups and the complexity of the hosting environment. A simple infection may be resolved quickly, while a persistent compromise can require substantially more investigation.

Sources and Further Reading

  • WordPress Security and official WordPress security releases
  • Google Search Console security guidance
  • WordPress security and hardening documentation
  • Established WordPress malware research and cleanup guidance