Imagine logging into your WordPress site — your digital storefront — and suddenly finding everything changed. Your homepage is defaced, strange pop-ups appear, or worse, Google flags it as “unsafe.”
If this has happened to you, take a deep breath. You’re not alone. According to recent data from Wordfence, over 13,000 WordPress websites are hacked every day. That’s one website every 6 seconds.
The good news? You can recover.
This guide will walk you step-by-step through how to recover a hacked WordPress website, clean up the damage, restore functionality, and reinforce your site’s security so it never happens again.
Whether you’re a beginner or a developer, you’ll learn exactly how to:
- Identify and remove malicious code
- Restore your website safely
- Strengthen your site’s defenses against future attacks
Keep reading to learn how to recover a hacked WordPress website and protect your digital presence for good.
Why Do WordPress Sites Get Hacked?
WordPress powers over 43% of the world’s websites, making it the most popular content management system (CMS). Unfortunately, popularity also attracts attackers.
The Most Common Reasons WordPress Websites Get Hacked
Cause | Explanation | How to Prevent It |
---|---|---|
Outdated Plugins or Themes | Old, unpatched plugins are the top reason sites get compromised. | Update regularly and remove unused ones. |
Weak Passwords | Simple passwords can be brute-forced in seconds. | Use strong passwords + two-factor authentication. |
Insecure Hosting | Cheap shared hosting may lack firewalls or isolation. | Use managed WordPress hosting with security layers. |
Pirated/Nulled Themes | These often come preloaded with malware. | Download only from trusted sources. |
No Backups | Without backups, recovery becomes a nightmare. | Automate daily backups using plugins. |
What Happens When a WordPress Site is Hacked
- SEO Damage: Google may blacklist your site, killing your organic traffic.
- Data Theft: Hackers can steal customer or admin data.
- Brand Reputation Loss: Visitors lose trust in your business.
- Financial Loss: Downtime can directly impact sales or ad revenue.
- Spam Redirects: Attackers often use hacked sites to distribute spam links.
Understanding why hacks happen is key to both recovery and prevention.
Need Help Recovering Your Hacked WordPress Site?
WordPress Security Experts Toronto
Ho to Know If Your WordPress Site Has Been Hacked
Sometimes the signs are obvious. Other times, they’re subtle — but the earlier you detect them, the easier recovery will be.
Common Symptoms of a Hacked WordPress Site
- Unfamiliar Admin Accounts
- Defaced Homepage or Random Ads
- Strange Redirects to External Websites
- Site Running Extremely Slow
- Email Deliverability Problems (blacklisted domain)
- Unauthorized Scripts or Files in wp-content
- Warning from Google Safe Browsing or Hosting Provider
Confirm the Hack with Security Tools
Use these free and paid tools to verify your suspicion:
- Sucuri SiteCheck – Free malware scanner for public websites.
- Wordfence Security – Plugin that detects and quarantines malware.
- MalCare – Auto-clean and real-time protection.
- Google Search Console – Check for security issues or manual penalties.
- cPanel Access Logs – Review unauthorized IPs or requests.
If you find suspicious files, malicious redirects, or unauthorized users — proceed immediately with cleanup.
How to Recover a Hacked WordPress Website: Step-by-Step Guide
Now let’s dive into exactly how to recover a hacked WordPress website, safely and systematically.
Step 1: Stay Calm and Assess the Situation
Panicking won’t help. What matters now is taking controlled, documented steps. Write down:
- When you first noticed the issue
- Recent plugin/theme changes
- Hosting or server modifications
Then, take your site offline temporarily to prevent visitors from being affected and stop further damage.
Step 2: Put Your Website in Maintenance Mode
You can enable maintenance mode via:
- Your hosting control panel
- A plugin like WP Maintenance Mode or SeedProd
Alternatively, you can create a simple index.html
file with a “maintenance” message. This isolates your site while you work.
Step 3: Back Up Everything (Before Cleaning)
Even though your site is compromised, always back it up before making any changes.
Back up:
- All files (via FTP or File Manager)
- The database (via phpMyAdmin or a plugin like UpdraftPlus)
This ensures you have a snapshot in case something goes wrong during cleaning.
Step 4: Change All Passwords and Access Credentials
Hackers often plant multiple backdoors, including compromised passwords.
Change passwords for:
- WordPress admin accounts
- Database user
- FTP/cPanel access
- Email accounts linked to WordPress
Also, revoke old sessions under Users > Profile > Sessions in WordPress.
Use strong passwords (mix of 12+ characters, symbols, uppercase, and numbers).
Activate Two-Factor Authentication (2FA) using Google Authenticator or Authy.
Step 5: Scan Your Website for Malware
Install one or more security plugins to scan your entire site.
Recommended Malware Scanners
- Wordfence Security – Deep server-side scanning.
- Sucuri Security – Cloud-based malware removal.
- MalCare – Automated one-click malware cleaning.
These tools will flag malicious code in:
- Core WordPress files
- Plugins or themes
- Database tables (like
wp_options
) - Uploaded files in
/uploads
Step 6: Identify and Remove Malicious Files
You can remove malware manually or automatically.
Manual Cleanup
- Access Files via FTP or File Manager
- Compare Core Files: Download a clean version of WordPress from WordPress.org and compare it with your current installation.
- Delete Unknown Files: Look for suspicious PHP files (like
wp-content/uploads/tmp.php
orwp-includes/shell.php
). - Check Key Files: Inspect
wp-config.php
,.htaccess
, andindex.php
for strange code or hidden scripts. - Remove Backdoors: Search for functions like
eval()
,base64_decode()
, orshell_exec()
— common in malware.
Automatic Cleanup
If manual cleanup seems risky:
- Use Sucuri, MalCare, or Wordfence Premium for automatic malware removal.
- These services will also patch vulnerabilities and monitor real-time attacks.
Step 7: Restore from a Clean Backup
If you have a backup from before the hack, it’s often the fastest recovery method.
Steps:
- Verify that the backup is clean (scan it before restoring).
- Restore it via your hosting panel or plugin.
- Reinstall WordPress core and update everything afterward.
Popular backup plugins:
- UpdraftPlus
- Jetpack Backup (VaultPress)
- BlogVault
Step 8: Reinstall WordPress Core Files
Even after cleaning, malicious code can hide in core files.
To be safe:
- Download the latest WordPress version.
- Overwrite your existing installation except:
wp-content/
wp-config.php
- This replaces compromised system files with fresh ones.
Step 9: Reinstall and Update Plugins & Themes
Plugins and themes are common attack vectors.
Actions:
- Delete unused or suspicious plugins/themes.
- Reinstall fresh copies from trusted repositories.
- Update everything to the latest version.
- Avoid “nulled” or pirated software — they are nearly always infected.
Step 10: Remove Unknown Users and Check Permissions
Go to Users → All Users and:
- Delete any unrecognized admin accounts.
- Change roles for suspicious users to “Subscriber” until reviewed.
Check your database for unauthorized accounts:
SELECT * FROM wp_users;
This command helps you spot hidden entries.
Step 11: Verify Site Cleanliness
Before going live again, confirm your website is fully clean:
- Scan again with Sucuri or Wordfence.
- Test your URLs with Google Safe Browsing.
- Check
robots.txt
for injected spam links. - Ensure all redirects are legitimate.
Once your scans return “Clean,” safely bring your website back online.
Also Read: SEO Web Design & Digital Marketing Near Toronto, Canada
How to Secure Your WordPress Site After Recovery
Congratulations — your site is back! Now, let’s make sure this never happens again
1. Update Everything Regularly
Outdated versions are hacker magnets.
Update:
- WordPress core
- Plugins
- Themes
- PHP (through hosting)
Enable auto-updates for trusted plugins or use a management tool like ManageWP.
2. Use a Web Application Firewall (WAF)
A firewall filters malicious traffic before it reaches your site.
Best WAF services:
- Cloudflare Pro – DNS-level protection.
- Sucuri Firewall – Application-level filtering.
- Wordfence Premium – Built-in WAF with real-time IP blocking.
3. Secure wp-config.php and .htaccess
Add the following to your .htaccess
:
<Files wp-config.php>
order allow,deny
deny from all
</Files>
And disable file editing:
define('DISALLOW_FILE_EDIT', true);
These simple tweaks block attackers from modifying critical files.
4. Enforce Strong Login Security
- Limit login attempts with Login LockDown or Limit Login Attempts Reloaded.
- Enable 2FA for all admins.
- Change your default login URL using WPS Hide Login.
5. Set Up Regular Backups
Backups are your best insurance policy.
Use:
- UpdraftPlus for automated backups to Google Drive or Dropbox.
- BlogVault for daily incremental backups.
- Jetpack Backup for real-time restore points.
Keep at least one offsite backup.
6. Monitor Site Activity
Install WP Activity Log to track:
- File changes
- Plugin updates
- User logins
This makes it easier to detect suspicious behavior early.
7. Use SSL and HTTPS Everywhere
Secure your website with a free SSL certificate from Let’s Encrypt.
It encrypts communication and boosts SEO rankings.
Also Read: SEO Web Design & Digital Marketing Near Toronto, Canada
Prevention: Keeping Your WordPress Site Hack-Proof
You’ve cleaned and secured your site — now it’s time to build resilience.
1. Choose Secure, Managed Hosting
Opt for hosting providers that specialize in WordPress security:
- Kinsta
- WP Engine
- SiteGround
They provide daily backups, SSL, and malware protection by default.
2. Delete What You Don’t Use
Every inactive plugin is a potential doorway for hackers.
Keep your WordPress installation minimal — delete anything unnecessary.
3. Disable XML-RPC (If You Don’t Use It)
XML-RPC enables remote connections but is often exploited for brute-force attacks.
Add this to .htaccess
:
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>
4. Restrict File Permissions
Ensure file permissions are strict:
- Folders:
755
- Files:
644
- wp-config.php:
600
You can update them via FTP or hosting control panel.
5. Schedule Regular Security Audits
Every 1–2 months:
- Scan for malware
- Test backups
- Check plugin sources
- Review admin access logs
Use services like Sucuri Monitoring or Wordfence Central for ongoing protection.
6. Educate Your Team
If multiple users manage your site, educate them on:
- Phishing email awareness
- Password hygiene
- Recognizing suspicious plugins
Security awareness reduces 90% of human-related breaches.
Sum Up
Recovering from a hacked WordPress site can feel overwhelming, but remember — it’s a problem you can fix.
By following this comprehensive guide on how to recover a hacked WordPress website, you can restore your online presence, secure your data, and regain visitor trust.
Once your site is clean:
- Rebuild confidence with your audience.
- Submit your site for a Google Security Review.
- Continue proactive maintenance and security monitoring.
The key takeaway: recovery is the first step — prevention is the long-term strategy.
Stay vigilant, stay updated, and your WordPress website will remain safe for years to come.
FAQs About Recovering a Hacked WordPress Website
How long does it take to recover a hacked WordPress website?
It depends on the extent of the infection. Basic hacks can be fixed in 2–4 hours, while deeper malware intrusions may take a day or more.
Can I recover my website without losing content?
Yes, if you have a clean backup. Use a verified backup plugin like UpdraftPlus or restore from your host’s automatic backup.
How can I check if my website is blacklisted?
Use Google Safe Browsing or Sucuri SiteCheck to verify blacklisting status.
What is the best plugin for WordPress security?
Wordfence, Sucuri, and iThemes Security are top-rated for firewall, malware detection, and brute-force protection.
Will my SEO rankings drop after a hack?
Yes, reinstalling ensures all infected core files are replaced with fresh ones, removing any hidden backdoors.
How often should I back up my website?
At least daily for active sites. For static blogs, weekly backups may suffice — but automate the process.
How often should I back up my website?
If vulnerabilities remain (outdated plugins, weak passwords, etc.), yes. That’s why post-recovery hardening is essential.