How to Clean a Hacked WordPress Site (Step-by-Step Guide) Print

  • WordPress, Clean WordPress, Remove Malware
  • 627

If your WordPress website has been hacked, time is of the essence. A compromised website not only affects your visitors' trust but can also lead to search engine blacklisting, data breaches, and further attacks. In this article, we’ll walk you through how to identify the hack, remove the malware, and secure your WordPress site for the future.

STEP 1: Confirm That Your Site Has Been Hacked

Before taking action, it’s important to confirm that your website has truly been hacked. You might notice unexpected redirects, strange content, a sudden drop in traffic, unfamiliar admin users, or even warnings from Google or browser antivirus tools. To be sure, scan your website using tools like Sucuri SiteCheck or Wordfence. These can detect malware, blacklisting issues, and hidden infections that may not be visible on the surface.

STEP 2: Put Your Website in Maintenance Mode

Once you’ve confirmed the hack, take your site offline temporarily. This step protects your visitors from malicious content and prevents further harm to your reputation. You can use a maintenance mode plugin or make manual adjustments through your file manager or cPanel. Displaying a brief notice that your site is undergoing maintenance for security reasons reassures users that you're actively resolving the issue.

STEP 3: Reset All Passwords

Immediately reset all login credentials associated with your website. This includes your WordPress admin account, database users, hosting control panel, and FTP or SFTP access. Use strong, unique passwords for each. Resetting passwords ensures that any backdoors or unauthorized logins created by the hacker will be disabled.

STEP 4: Create a Complete Backup

Before starting the cleanup, make a full backup of your website, including both the files and the database. Even though your site has been compromised, having a backup allows you to restore specific elements or reverse changes if something goes wrong during the cleaning process. Save this backup to a secure location like your computer or cloud storage.

STEP 5: Scan Your Site for Malware and Infected Files

Use a reliable WordPress security plugin like Wordfence, Sucuri, or MalCare to run a full scan of your site. These tools will help identify malware, altered files, suspicious code, or unauthorized users. Pay close attention to your core WordPress files, plugins, themes, and database entries, especially in sensitive files like wp-config.php, .htaccess, and functions.php.

STEP 6: Remove Malware and Clean Your Files

After identifying the infected components, begin the cleanup process. Start by replacing your core WordPress files with fresh copies from the official WordPress repository. Delete or reinstall any compromised plugins or themes. If any files contain malicious code, you can either remove the code manually or restore the file from a clean backup. Also, delete any unknown admin users that may have been created by the attacker.

STEP 7: Update WordPress, Plugins, and Themes

Outdated software often serves as an entry point for hackers. Once your site is clean, update WordPress to the latest version. Do the same for all installed plugins and themes. If there are unused plugins or themes, remove them entirely. Avoid using nulled or pirated themes and plugins, as these are notorious for carrying malware.

STEP 8: Secure Your Site After Cleanup

Now that your site is clean, it’s time to strengthen its security. Install a firewall using a trusted plugin like Wordfence or Sucuri. Disable file editing within the WordPress dashboard and limit login attempts to block brute-force attacks. You should also change your default login URL, enable two-factor authentication (2FA), and schedule regular backups going forward.

STEP 9: Request a Review from Google if Blacklisted

If your site was blacklisted by Google, you need to request a review after cleaning it. Log in to Google Search Console and go to the “Security Issues” section. Click “Request a Review” and describe the actions you’ve taken to resolve the issue. If everything checks out, Google will remove the warning from your site.

STEP 10: Monitor Your Site Regularly

After restoring your site, continue to monitor it for unusual activity. Use plugins that provide activity logs, real-time alerts, and daily scans. Also, set up uptime monitoring tools to notify you immediately if your site goes offline. Staying proactive is the best way to prevent future hacks and keep your site secure.

If you need help restoring your website, our expert support team is available 24/7.


Was this answer helpful?

« Back