How to Restore Your Hacked WordPress Website

Sajidul Islam March 10, 2025
6 min read
1,039 words
How to Restore Your Hacked WordPress Website

Introduction

A hacked WordPress website can be a nightmare, causing data loss, security risks, and damage to your online reputation. If your WordPress website gets hacked, acting swiftly is crucial to minimize harm and regain control. Cyberattacks are becoming increasingly common, and even well-maintained websites can fall victim to hackers. This guide will walk you through the essential steps to recover your site, secure it, and prevent future attacks.

If your WordPress website gets hacked, follow these steps immediately:

  • Stay Calm and Assess the Damage – Identify the symptoms of hacking, such as unauthorized changes, slow performance, or security warnings.
  • Put Your Site in Maintenance Mode – Prevent further issues while working on a fix by restricting access to visitors.
  • Scan for Malware and Remove It – Use security plugins like Wordfence or Sucuri to detect and eliminate malicious code.
  • Restore from a Clean Backup – If you have a backup, revert your site to a secure state before the hack occurred.
  • Change All Passwords – Update WordPress, database, and hosting credentials to prevent further unauthorized access.
  • Check and Fix Vulnerabilities – Remove infected files, update plugins/themes, and patch security loopholes.
  • Secure Your Website for the Future – Implement firewalls, enable two-factor authentication, and schedule regular security checks.

Now, let’s dive into each step in detail.

Step 1: Stay Calm and Assess the Damage

When your WordPress website gets hacked, the first thing to do is assess the extent of the damage. Avoid panicking, as quick and strategic action is required. Look for these common signs of hacking:

  • Unusual redirects to malicious or spammy sites.
  • Defaced homepage with altered text or images.
  • New or unauthorized admin users appearing in your WordPress dashboard.
  • A significant slowdown in website performance or increased server resource usage.
  • Security alerts from Google or warnings from your hosting provider about malware infections.

Document any suspicious activity, as this information will be useful when cleaning up your site and preventing future attacks.

Step 2: Put Your Site in Maintenance Mode

To prevent visitors from accessing your hacked website and possibly getting infected, activate maintenance mode. This also helps you avoid losing credibility while working on a fix. You can use a plugin like WP Maintenance Mode or SeedProd to display a temporary message while you clean and restore your site. Additionally, inform your team or users (if applicable) that the site is under maintenance due to security reasons.

Step 3: Scan for Malware and Remove It

Hackers often inject malicious scripts or backdoors into WordPress files. Use a trusted security plugin to scan for malware and remove infected files. Some top security plugins include:

  • Wordfence Security – Provides deep scanning, firewall protection, and malware removal.
  • Sucuri Security – Monitors file integrity, scans for vulnerabilities, and removes threats.
  • MalCare – Offers automated malware detection and one-click removal.

If malware is found, follow the plugin’s recommendations to remove it. If the infection is severe, consider hiring a professional security expert to clean your site.

Step 4: Restore from a Clean Backup

If you have a backup from before the hack occurred, restore your site using a tool like UpdraftPlus, VaultPress (Jetpack Backup), or your hosting provider’s backup service. Before restoring, ensure that the backup is clean by scanning it for malware. Restoring from a backup is one of the quickest ways to regain control of your site if the damage is extensive.

Step 5: Change All Passwords and Update Credentials

After restoring your WordPress website, update all credentials to prevent unauthorized access. Hackers may have stolen login information, so changing passwords is crucial. Update the following:

  • WordPress Admin Password – Use a strong, unique password with a mix of letters, numbers, and special characters.
  • Database Password – Change your database credentials from your hosting control panel.
  • FTP/CPanel Password – Secure your hosting account with a new password.
  • API Keys for Third-Party Integrations – If your site connects to external services, update API keys to prevent unauthorized access.

Using a password manager like LastPass or Bitwarden can help you generate and store strong passwords securely.

Step 6: Check and Fix Vulnerabilities

Hackers often exploit outdated plugins, weak passwords, or poorly configured settings. After regaining control of your site, take the following steps to enhance security:

  • Delete Unused Plugins and Themes – Unused or outdated plugins can be entry points for hackers. Remove anything unnecessary.
  • Update WordPress Core, Plugins, and Themes – Running the latest versions helps patch known vulnerabilities.
  • Check File Permissions – Set proper file permissions to restrict unauthorized access. Typically, directories should have 755 permissions, and files should have 644.
  • Review User Roles – Ensure only trusted users have admin access. Remove any suspicious user accounts.
  • Inspect .htaccess and wp-config.php – Check these files for unauthorized modifications or malicious code injections.

Step 7: Secure Your Website for the Future

After recovering from a hack, take preventive measures to avoid future attacks. Security should be an ongoing priority to keep your website safe.

1. Use a Security Plugin

Install and configure a WordPress security plugin such as Wordfence, Sucuri, or iThemes Security to block malicious traffic and protect your site in real-time.

2. Enable Two-Factor Authentication (2FA)

Two-factor authentication adds an extra layer of security by requiring a secondary code during login. Use plugins like Google Authenticator or Duo Security to set up 2FA.

3. Limit Login Attempts

Protect against brute-force attacks by restricting failed login attempts. The Limit Login Attempts Reloaded plugin can help enforce this security measure.

4. Use SSL (HTTPS)

Secure your website with an SSL certificate to encrypt data exchanged between users and your server. Most hosting providers offer free SSL certificates via Let’s Encrypt.

5. Schedule Regular Backups

Regular backups ensure that you can restore your site quickly if it gets hacked again. Automate backups with UpdraftPlus, BackupBuddy, or your hosting provider’s built-in backup service.

6. Monitor Website Activity

Keep track of website activity using security logs. Plugins like WP Activity Log help detect suspicious actions, unauthorized logins, or file modifications.

Conclusion

If your WordPress website gets hacked, quick action is essential to minimize damage. Follow the steps outlined in this guide to recover your site, remove malware, and enhance security. Regular maintenance, strong passwords, and proactive security measures can prevent future hacks, ensuring your website remains safe and operational. Investing time in website security today can save you from major issues in the future.

About Sajidul Islam

WordPress developer passionate about creating beautiful, functional websites.

View all posts
Get In Touch

Have a Project in Mind?

Let's discuss how I can help bring your vision to life with a custom WordPress solution.