How to Remove Malware from a Hacked WordPress Site

  • 9 min read
  • Mike
  • 493 Views
How to Remove Malware from a Hacked WordPress Site

In 2026, WordPress powers over 43% of websites globally, but its popularity makes it a prime target, with 90% of hacked CMS sites being WordPress-based (Sucuri, WPBeginner). Malware can compromise user data, tank SEO rankings, and disrupt e-commerce operations, costing businesses thousands (e.g., $3,000-$10,000 in recovery, Wordfence). For a sportswear blog or store in India, a hacked site can erode trust and sales. This step-by-step guide walks you through identifying, removing, and preventing malware on a hacked WordPress site using plugins, manual methods, and best practices to restore and secure your site in 2026.

Image Suggestion: A screenshot of a WordPress dashboard with a Wordfence scan detecting malware. Source from wordfence.com or create a mockup using Canva.


Why Malware Attacks Happen and Their Impact

Malware (e.g., malicious scripts, redirects, backdoors) often exploits outdated plugins, weak passwords, or unpatched vulnerabilities. Impacts include:

  • SEO Damage: Google blacklists hacked sites, dropping rankings by 50-70% (Sucuri).
  • Revenue Loss: E-commerce sites (e.g., sportswear stores) lose 20-30% of sales due to downtime or trust issues (WPBeginner).
  • Data Breaches: Customer data leaks (e.g., emails, payment info) trigger legal issues under GDPR or India’s DPDP Act.
  • Site Performance: Malware slows load times, increasing bounce rates (70% average, Baymard Institute).

Image Suggestion: An infographic showing malware impact (e.g., 70% ranking drop, 30% revenue loss) with icons for security and e-commerce. Create using Canva.


Prerequisites for Malware Removal

Before starting, ensure:

  • Admin Access: Ability to log into your WordPress dashboard and hosting panel.
  • Backup: A clean backup of your site (use UpdraftPlus, free/$42/year).
  • Hosting Details: FTP/SFTP credentials and database access (e.g., via cPanel, SiteGround).
  • Security Tools: A computer with antivirus software to avoid reinfection.
  • Time: Allocate 2-4 hours for thorough cleanup.

Image Suggestion: A screenshot of UpdraftPlus’s backup settings in the WordPress dashboard. Source from wordpress.org.


Step-by-Step Guide to Remove Malware from a Hacked WordPress Site

Step 1: Identify the Hack

  1. Recognize Symptoms:
    • Suspicious redirects (e.g., to spam sites).
    • Slow site performance or 404/500 errors.
    • Google warnings (e.g., “This site may be hacked” in search results).
    • Unauthorized admin users or strange files in hosting.
  2. Run a Security Scan:
    • Install Wordfence Security (free/$99/year) or Sucuri Security (free/$199/year) from Plugins > Add New.
    • Go to Wordfence > Scan or Sucuri > Malware Scan and start a scan.
    • Review results for infected files (e.g., wp-content/uploads/malware.php) or database issues.
  3. Check Google Search Console:
    • Visit search.google.com and check Security Issues for malware alerts.

Image Suggestion: A screenshot of Wordfence’s scan results highlighting a malicious file. Source from wordfence.com.

Step 2: Put Your Site in Maintenance Mode

  1. Enable Maintenance Mode:
    • Install WP Maintenance Mode (free) from Plugins > Add New.
    • Go to Settings > WP Maintenance Mode and activate to prevent visitor access during cleanup.
  2. Notify Users:
    • Display a message like “We’re undergoing maintenance to improve your experience” to maintain trust (e.g., for sportswear customers).

Image Suggestion: A screenshot of a WordPress site in maintenance mode with a custom message. Source from wordpress.org or Canva.

Step 3: Create a Full Backup

  1. Use a Backup Plugin:
    • In UpdraftPlus > Backup/Restore, create a backup of files and database.
    • Store backups on Google Drive or Dropbox (requires UpdraftPlus Premium, $42/year).
  2. Manual Backup via Hosting:
    • Log into your hosting panel (e.g., SiteGround, Bluehost).
    • Download files via FTP (FileZilla) and export the database via phpMyAdmin.
  3. Verify Backup:
    • Ensure the backup is malware-free by scanning with Wordfence or Sucuri.

Image Suggestion: A screenshot of UpdraftPlus’s backup confirmation in the WordPress dashboard. Source from wordpress.org.

Step 4: Remove Malware

Option 1: Use a Security Plugin

  1. Wordfence Cleanup:
    • Go to Wordfence > Scan > Scan Results.
    • Delete or quarantine infected files (e.g., wp-includes/hacked-script.php).
    • Repair modified core files using Wordfence’s “Repair Files” option.
  2. Sucuri Cleanup:
    • Use Sucuri > Malware Scan to identify and remove malicious code.
    • Enable Hardening options (e.g., block PHP execution in uploads folder).
  3. Database Check:
    • Use Wordfence > Tools > Diagnostics to scan for malicious database entries (e.g., spam links in posts).

Option 2: Manual Cleanup

  1. Access Files via FTP:
    • Connect to your server using FileZilla (SFTP credentials from hosting).
    • Check wp-content/plugins, wp-content/themes, and wp-content/uploads for unfamiliar files (e.g., eval() or base64_decode scripts).
    • Delete suspicious files or replace with clean versions from wordpress.org.
  2. Clean the Database:
    • In phpMyAdmin, search for malicious code (e.g., <script> tags in wp_posts).
    • Delete or edit affected rows (backup first).
  3. Replace Core Files:
    • Download a fresh WordPress version from wordpress.org (e.g., 6.7).
    • Replace wp-admin and wp-includes folders via FTP, preserving wp-content.

Image Suggestion: A screenshot of FileZilla showing a WordPress site’s wp-content/uploads folder with a suspicious file. Source from a demo or Canva.

Step 5: Secure Your Site

  1. Update Everything:
    • Update WordPress, themes, and plugins to the latest versions (e.g., WordPress 6.9, 2026).
    • Go to Dashboard > Updates and click Update Now.
  2. Change Credentials:
    • Reset all admin passwords (use strong passwords, 16+ characters).
    • Update database credentials in wp-config.php via FTP.
    • Generate new API keys for plugins (e.g., WooCommerce, Yoast).
  3. Remove Unauthorized Users:
    • Go to Users > All Users and delete unknown admin accounts.
  4. Harden Security:
    • Install iThemes Security (free/$99/year) to enable 2FA, block bad IPs, and protect .htaccess.
    • Add to .htaccess:<Files wp-config.php> Order Allow,Deny Deny from all </Files>
    • Limit login attempts with Limit Login Attempts Reloaded (free).

Image Suggestion: A screenshot of iThemes Security’s hardening settings in the WordPress dashboard. Source from wordpress.org.

Step 6: Restore and Test

  1. Restore the Site:
    • Disable maintenance mode in WP Maintenance Mode > Settings.
    • Test all pages, forms, and e-commerce features (e.g., WooCommerce checkout for a sportswear store).
  2. Run a Final Scan:
    • Use Wordfence or Sucuri to confirm no malware remains.
  3. Check Functionality:
    • Test links, forms, and checkout (e.g., INR payments for Indian customers).
    • Use incognito mode or a VPN to verify global access.

Image Suggestion: A screenshot of a clean Wordfence scan result confirming no malware. Source from wordfence.com.

Step 7: Prevent Future Attacks

  1. Use a Web Application Firewall (WAF):
    • Enable Wordfence’s WAF or Cloudflare’s free plan to block malicious traffic.
  2. Regular Backups:
    • Schedule daily backups with UpdraftPlus to Google Drive.
  3. Monitor Activity:
    • Use Activity Log (free) to track admin actions and detect unauthorized changes.
  4. Update Regularly:
    • Check for updates weekly in Dashboard > Updates.
  5. Educate Users:
    • Train team members on strong passwords and phishing awareness.

Pro Tip: For a sportswear store, secure WooCommerce with iThemes Security’s e-commerce settings to protect customer data and maintain trust.

Image Suggestion: A screenshot of Cloudflare’s WAF settings for a WordPress site. Source from cloudflare.com or Canva.


Best Practices for WordPress Security

  • Choose Reliable Hosting: Use managed hosts like SiteGround ($2-$15/month) with built-in security.
  • Optimize Site Speed: Use WP Rocket ($59/year) to maintain PageSpeed scores (90+) post-cleanup.
  • Enable 2FA: Use iThemes Security or Wordfence for two-factor authentication.
  • Monitor SEO: Submit an updated sitemap to Google Search Console after cleanup to restore rankings.
  • Backup Offsite: Store backups on Dropbox or Google Drive, not on the server.

Image Suggestion: A screenshot of Google Search Console showing a sitemap resubmission post-cleanup. Source from search.google.com or Canva.


Challenges and Solutions

  • Issue: Malware persists after cleanup.
    Solution: Re-run Wordfence/Sucuri scans; replace all core files with a fresh WordPress download.
  • Issue: Site downtime during cleanup.
    Solution: Use WP Maintenance Mode and inform users via social media (e.g., X posts for sportswear customers).
  • Issue: Google blacklist remains.
    Solution: Request a review in Google Search Console after verifying no malware.
  • Issue: High cleanup costs for complex sites.
    Solution: Use free plugins (Wordfence, Sucuri) or hire a pro via Upwork ($50-$200).

Image Suggestion: A screenshot of Google Search Console’s Security Issues page showing a blacklist removal request. Source from search.google.com.


Article Statistics & Official Verification Links

Statistic / Security ClaimVerification Source / Link
“11,334 WordPress vulnerabilities discovered in 2025”Colorlib: Patchstack 2026 WordPress Security Report
“91.1% of all vulnerabilities originate in third-party plugins”SolidWP: WordPress Vulnerability Report April 2026
“Median time to mass exploitation is now only 5 hours”Colorlib: 2026 WordPress Hacking Statistics
“Average cost of a cyberattack for an SMB: $56,600”Computer One: 2026 Cybercrime Costs Analysis
“XSS (Cross-Site Scripting) accounts for 47.7% of hacks”Whitehat SEO: WordPress Security Issues 2026
“43% of vulnerabilities are exploitable without authentication”Colorlib: WordPress Hacking Data (Patchstack 2026)

Frequently Asked Questions: Recovering from a WordPress Malware Infection

My site is hacked; should I immediately restore my latest backup?

Not necessarily. In 2026, hackers often inject “sleeper” malware that remains dormant for weeks before activating. If you restore a backup from three days ago, you might just be reinstalling the hack.
– The Protocol: First, identify the “Date of Infection” by checking for the most recently modified files via SSH. Use the command: find . -mtime -5 to see everything changed in the last 5 days.

How do I find malware that is “invisible” to standard scanners?

Advanced malware often uses Base64 encoding or obfuscation to hide within legitimate files like functions.php. For our technical team, a “mechanical necessity” is using the grep command to search for suspicious patterns:
– grep -rnw . -e "base64_decode"
– grep -rnw . -e "eval(" These commands help you find code that is trying to hide its true intent from the server.

Is it safe to just delete the “wp-content/plugins” folder?

Mostly, yes. Since your plugin data is stored in the database, deleting the files won’t delete your settings. For a “Clean Sweep,” we recommend:
– Deleting all folders in /plugins/ and /themes/ (except your active child theme).
– Re-downloading fresh copies from WordPress.org or your premium developer. This ensures you aren’t leaving behind any Backdoors disguised as legitimate plugin files.

Why does the malware keep coming back after I clean it?

This is usually due to a Backdoor or a Compromised Database.
– Backdoors: Small snippets of code hidden in wp-config.php or the /uploads/ folder (where no PHP should ever exist).
– Database: Check the wp_users table for new “Administrator” accounts you didn’t create. In 2026, hackers also hide malicious scripts in the wp_options table under “Auto-load” settings.

How does a hack affect my “Interaction to Next Paint” (INP) score?

Malware often uses your server’s resources to send spam emails or mine cryptocurrency in the background. This “Resource Exhaustion” slows down your entire site, causing a massive spike in INP and Largest Contentful Paint (LCP). If your site feels sluggish despite no traffic, a malware scan is the first step in a performance audit.