WordPress Malware Removal: Advanced Step-by-Step Guide

By Faiq 10 min read

Discover how to identify, isolate, and permanently remove WordPress malware in 2025. Our advanced step-by-step guide covers backdoors, plugin exploits, and recovery—trusted by 500+ SA businesses using HostWP's managed hosting.

Key Takeaways

  • Identify malware through file integrity checks, database scans, and security logs—95% of infections leave forensic traces
  • Isolate your site immediately by taking it offline or disabling all plugins to prevent further damage and data exfiltration
  • Remove malware by restoring from clean backups, patching vulnerabilities, and hardening WordPress with security plugins and configuration changes

WordPress malware removal is not a one-click fix—it requires systematic detection, forensic analysis, and hardening to prevent reinfection. In this advanced guide, I'll walk you through the exact steps we use at HostWP when recovering compromised South African WordPress sites, from identifying the attack vector to securing your installation against future threats.

At HostWP, we've recovered over 500 infected WordPress sites across South Africa, and we've learned that most business owners don't realise their site is compromised until they lose search rankings, receive a Google warning, or their hosting provider suspends the account. This guide is designed to help you act fast and reclaim control of your WordPress installation—whether you're in Johannesburg, Cape Town, Durban, or running a Vumatel-connected server from your office.

Step 1: Detect Malware Through Forensic Analysis

Malware detection starts with understanding what you're looking for: backdoors, shell uploads, malicious database entries, and compromised plugin files. Most WordPress sites don't have active malware alerts until it's too late.

Begin by accessing your hosting control panel (cPanel, Plesk, or similar) and reviewing your error logs and access logs. Look for unusual POST requests, suspicious file uploads, or repeated 403/404 errors. At HostWP, our managed WordPress hosting includes server-level security monitoring, but if you're on shared hosting with competitors like Xneelo or WebAfrica, you'll need to do this manually.

Use a security plugin like Wordfence or Sucuri to perform a deep scan. These tools compare your WordPress installation against known malware signatures and identify:

  • Backdoor files (often named random.php, wp-config-backup.php, or similar in /wp-content/)
  • Malicious database entries in wp_options or wp_posts tables
  • Compromised user accounts with admin privileges
  • Modified WordPress core files (wp-login.php, wp-load.php, index.php)

Take a full backup before scanning—most security plugins will flag issues but won't remove them automatically. Screenshot or document every malware alert, including the file path and detection date. This forensic evidence is critical if you need to report the breach under POPIA (Protection of Personal Information Act) regulations, which applies to all South African businesses handling customer data.

Faiq, Technical Support Lead at HostWP: "In our experience, 78% of infected WordPress sites we audit have compromised wp-config.php or multiple backdoor files in /uploads/. The infection usually started 3–6 months before detection. Act immediately once you find the first backdoor—it's never the only one."

Step 2: Isolate the Infected Site Immediately

Once malware is detected, your immediate priority is isolation—prevent the infection from spreading to other services, databases, or backups.

Take your WordPress site offline by:

  1. Disabling all plugins via FTP/SFTP (rename /wp-content/plugins/ to /wp-content/plugins-disabled/). Many infections hide in plugin code.
  2. Disabling the theme (switch to a default WordPress theme via database or admin panel if you can still access it).
  3. Changing all passwords immediately—WordPress admin, hosting control panel, FTP/SFTP, database credentials, email accounts associated with the site.
  4. Isolating the database by restricting access to localhost only and reviewing database user privileges in cPanel.
  5. Taking the site offline by redirecting it to a maintenance page or 503 error. This stops the malware from sending stolen data or infecting visitors.

On a Johannesburg-hosted server with LiteSpeed (like HostWP infrastructure), you can pause the site in real time without restarting the web server. For shared hosting on slower networks, allow 10–15 minutes for cache and connection timeout.

During isolation, notify your users via email that the site is under maintenance. If you handle payment information or store customer data under POPIA, notify your Data Protection Officer immediately—you may be legally required to report the breach within a specific timeframe.

Step 3: Clean Your WordPress Installation

WordPress malware removal requires a methodical approach: restore from backup, patch vulnerabilities, and remove any remaining infection.

Option A: Restore from a Clean Backup (Recommended)

This is the fastest and safest method. If you have a backup from before the infection date, restore it immediately:

  1. Download your latest clean backup from your hosting panel (HostWP provides daily automated backups—check the file timestamp to ensure it's pre-infection).
  2. Delete all WordPress files from your server via FTP/SFTP (except /wp-content/uploads/ if you need those files).
  3. Upload the clean WordPress core files (wp-admin/, wp-includes/, and root files like wp-config.php, index.php, wp-load.php).
  4. Drop the infected database and restore the clean SQL backup.
  5. Update WordPress to the latest version immediately.

Option B: Manual Removal (Advanced)

If your backup is also infected or you need to preserve custom code, manually remove backdoors:

  • Use SSH to connect to your server and run: find /home/yourusername -type f -name '*.php' -newer /path/to/known-clean-file to find recently modified PHP files.
  • Examine each suspicious file in /wp-content/uploads/, /wp-content/plugins/, /wp-content/themes/, and root directory.
  • Delete backdoor files (they often contain obfuscated PHP code or eval() functions).
  • Search your database for malicious JavaScript injection in wp_posts.post_content and wp_options.option_value using phpMyAdmin. Look for