What to Do If Your WordPress Site Gets Hacked? 7 Simple Steps to Fix It (2026 Updated)
What to do if your WordPress site gets hacked? 7 simple steps to remove malware, fix errors, and secure your site. Professional help available.
Has your WordPress website started redirecting visitors to unfamiliar websites? Are you seeing strange pages in Google search results, unknown administrator accounts, or security warnings when you open your site?
These can be signs of a hacked WordPress website. If you notice them, it is important to investigate the problem carefully instead of making random changes.
A hacked website does not always mean that you have lost everything. In many cases, you can recover the website by identifying the problem, cleaning compromised files or content, securing access, and checking that the original issue has been resolved.
In this guide, I'll explain 7 practical steps to take if your WordPress website gets hacked, including what to do first, how to approach malware cleanup, and how to reduce the risk of another attack.
Look for these warning signs:
A hacked website does not always mean that you have lost everything. In many cases, you can recover the website by identifying the problem, cleaning compromised files or content, securing access, and checking that the original issue has been resolved.
In this guide, I'll explain 7 practical steps to take if your WordPress website gets hacked, including what to do first, how to approach malware cleanup, and how to reduce the risk of another attack.
How Can You Tell If Your WordPress Website Has Been Hacked?
Sometimes, a website owner notices an attack immediately. In other cases, the problem remains hidden until a visitor, hosting provider, or search engine reports it.Look for these warning signs:
- Your website redirects visitors to unfamiliar websites.
- Spam pages or unexpected keywords appear in Google search results.
- Unknown administrator accounts appear in WordPress.
- Your homepage or other pages contain content you did not add.
- Your hosting provider reports suspicious files or unusual activity.
- Google Search Console displays a security warning.
- Your browser shows a warning when visitors try to access your website.
- New files or unexpected code appear in your WordPress installation.
- Your website stops working after an unauthorized change.
What to Do If Your WordPress Website Gets Hacked: 7 Steps
Step 1: Protect Your Website and Record the Evidence
Your first priority should be protecting your visitors and preventing the problem from getting worse.
If your website is distributing malware, displaying phishing pages, or redirecting visitors to dangerous destinations, contact your hosting provider promptly. Depending on the risk, the provider may help restrict access or temporarily isolate the affected website.
Before making major changes, record what you have observed:
- Which pages are affected?
- When did the problem start?
- Are visitors being redirected?
- Are there unknown administrator accounts?
- Has your hosting provider sent any security alerts?
- Did the problem begin after a recent update or configuration change?
Take screenshots of visible errors and save relevant security notifications.
If possible, preserve a backup or snapshot of the affected website for investigation. An infected backup is not a clean recovery copy, but it may help you understand what happened.
Do not open suspicious links or intentionally visit dangerous pages just to collect evidence.
Important: If you suspect a serious compromise, avoid making repeated changes before you understand the situation. Randomly deleting files can destroy useful evidence or damage the website further.
Step 2: Create a Backup Before Cleaning
Before removing malware or replacing files, create a backup of the current website if it is safe and technically possible.
A complete WordPress backup generally includes:
- Website files
- The WordPress database
- Important configuration files
- Relevant uploads and custom content
Store the backup securely, preferably outside the affected hosting environment. Restrict access because the backup may contain compromised files, sensitive configuration details, or customer information.
Keep in mind that a backup of a hacked website is not automatically safe to restore.
If you have a verified clean backup from before the attack, it may be useful for recovery. However, restoring it without addressing the original security weakness may allow the attacker to compromise the website again.
If your website handles customer orders or important business data, take special care to preserve legitimate changes made after the backup date.
Step 3: Investigate the Website and Confirm the Problem
The next step is to identify what has actually been affected.
Start with the evidence you collected and investigate the website systematically.
Check WordPress Users
Open Users → All Users if you can safely access the dashboard.
Look for administrator accounts you do not recognize. Do not assume every unfamiliar username is malicious; verify whether the account belongs to a legitimate team member or service provider.
If an account is confirmed to be unauthorized, record the relevant details and plan to remove its access safely.
Check Files and Recent Changes
Review suspicious files, unexpected code changes, and recently modified files using your hosting File Manager, FTP/SFTP, or another appropriate method.
A recently modified file is not automatically malicious. WordPress updates and normal maintenance also change files. Compare suspicious files against trusted sources and investigate their contents before removing them.
Check the Database
Attackers may add spam content, unauthorized links, or malicious data to the WordPress database.
Investigate suspicious posts, pages, options, and other database records when the symptoms suggest database manipulation. Make a backup before editing database content directly.
Check Google Search Console
If your website is verified in Google Search Console, open the **Security Issues** report. Also review the Manual Actions report if you suspect search spam.
These reports can provide useful evidence, but the absence of a warning does not guarantee that every part of your website is clean.
Official guide: https://support.google.com/webmasters/answer/9044101
Step 4: Remove Malware and Restore Compromised Files
Once you understand the problem, begin the cleanup process.
The correct method depends on the type and extent of the compromise. Some websites contain injected spam content, while others have malicious code, unauthorized accounts, or hidden backdoors that allow an attacker to regain access.
A careful cleanup may include the following actions:
Scan the website. Use a reputable security scanner to identify suspicious files and possible malware. Review the findings rather than assuming every warning confirms an infection.
Inspect suspicious files. Compare affected files with clean versions from trusted sources. Investigate unexpected PHP files, unauthorized code, and changes that cannot be explained by normal website activity.
Replace compromised core files. When WordPress core files are damaged or modified, replace them using trusted files that match the appropriate WordPress version. Preserve the configuration, uploads, and legitimate website content that must remain.
Review plugins and themes. Update vulnerable components where appropriate, remove software you no longer need, and replace compromised files with clean versions from trusted sources.
Clean the database. Remove confirmed malicious content and unauthorized changes without deleting legitimate posts, products, orders, or other important records.
Investigate backdoors. Look for mechanisms that could allow unauthorized access to continue after the visible malware has been removed.
Do not delete unfamiliar files simply because their names look suspicious. Some legitimate WordPress, theme, and plugin files may be unfamiliar to a beginner.
For more detailed guidance, consult the official WordPress documentation:
If the compromise affects many files, involves a hidden backdoor, or is beyond your technical experience, consider getting professional help rather than risking further damage.
Step 5: Secure Accounts and Fix the Security Weakness
Cleaning the visible malware is only part of the recovery process. You must also reduce the chance that the attacker can regain access.
After you have secured the environment sufficiently to avoid exposing new credentials to an ongoing compromise, take these actions:
- Change WordPress administrator passwords.
- Change passwords for hosting, FTP/SFTP, and other affected accounts.
- Review database credentials if they may have been exposed.
- Remove confirmed unauthorized users.
- Review user roles and permissions.
- Enable two-factor authentication where supported.
- Update WordPress, plugins, themes, and server software as appropriate.
- Remove unused plugins and themes when safe to do so.
- Check file permissions and other relevant security settings.
Use long, unique passwords that are not reused on other services.
If you change the database username or password, update the corresponding configuration safely and verify that the website can still connect to the database.
Also investigate how the attacker gained access. Possible causes include vulnerable software, compromised credentials, insecure hosting settings, or an existing backdoor.
If the original weakness remains, removing malware alone may not prevent another compromise.
Step 6: Test the Website and Check for Remaining Problems
After cleaning the website and securing access, verify the results carefully.
Do not rely on a single scanner or one successful homepage load.
Check the following:
- The homepage and important internal pages load correctly.
- Unexpected redirects no longer occur.
- Unknown administrator accounts and unauthorized content have been addressed.
- Important files and database records have been reviewed.
- Forms, login pages, and other key features work as expected.
- If you use WooCommerce, check product pages, cart, checkout, and order-related functions.
- Security scans and available server logs show no unresolved findings that require attention.
- Hosting and security alerts have been reviewed.
- Backups are working and stored securely.
If you have access to Google Search Console, review its Security Issues report and investigate the affected URLs it identifies.
Remember that a clean scan is useful evidence, but it does not prove that every possible backdoor or compromised account has been found. Verification should reflect the original symptoms and the scope of the investigation.
Step 7: Recover Google Search Visibility and Monitor the Website
If Google has flagged your website for malware, hacked content, or another security issue, you may need to take additional steps after cleaning it.
First, confirm that the reported problems have been resolved across the affected pages.
Then:
- Open Google Search Console.
- Select your verified website property.
- Review the Security Issues report and any affected URL examples.
- Confirm that the identified issues have been fixed throughout the website.
- Submit a review request when the report offers that option and the website is ready.
Describe the cleanup and the corrective actions you actually performed. Do not request a review before the problem has been resolved.
Google's review process may take several days or, for some hacked spam issues, several weeks. Search results and browser warnings may not update immediately after cleanup.
Official guide: https://support.google.com/webmasters/answer/6347750
After recovery, continue monitoring your website for new administrator accounts, suspicious file changes, unexpected redirects, and fresh security alerts.
Important: Cleaning a hacked website does not guarantee an immediate return to its previous search rankings. Search visibility depends on several factors, and recovery may take time.
Why Do WordPress Websites Get Hacked?
Understanding the possible entry point helps prevent another attack.
Common causes include:
Outdated plugins or themes: Vulnerable software may allow an attacker to exploit a known weakness.
Weak or reused passwords: Passwords exposed through another service may be used to attempt access to your website.
Compromised administrator accounts: An attacker may gain access through stolen credentials or an existing unauthorized account.
Insecure hosting or configuration: Poorly secured access, inappropriate permissions, or exposed services can increase risk.
Untrusted software: Modified or untrusted themes and plugins may introduce malicious code.
Existing backdoors: Malware left behind during an earlier incident may allow an attacker to regain access.
Not every attack has the same cause. A proper investigation should identify the most likely entry point using available evidence rather than guessing.
How to Protect Your WordPress Website After Recovery
Once your website is back under control, maintain a practical security routine.
- Keep WordPress core, plugins, and themes updated.
- Remove unused software that is no longer needed.
- Use strong passwords and two-factor authentication where appropriate.
- Limit administrator access to people who genuinely need it.
- Maintain regular, tested backups.
- Use a reputable security plugin or monitoring solution where appropriate.
- Review hosting security and account access.
- Monitor security alerts and unusual website activity.
- Test important website functions after major changes.
- Investigate recurring warnings instead of ignoring them.
Security is an ongoing process. Regular maintenance and monitoring can help you identify new problems earlier.
Frequently Asked Questions
1. Can I recover a hacked WordPress website?
Yes, many hacked WordPress websites can be recovered. The method depends on the type of compromise, the available backups, and whether the original security weakness can be identified and corrected.
2. Should I delete my WordPress website and reinstall everything?
Not necessarily. A complete rebuild may be appropriate in some cases, but deleting everything immediately can cause unnecessary data loss. First, preserve the available evidence, identify the affected components, and choose a recovery method that protects legitimate content and business data.
3. Is a WordPress security scanner enough to remove malware?
Not always. A scanner can identify known threats and suspicious files, but some compromises may require manual investigation of files, database records, user accounts, and backdoors. Verify the findings before deciding that cleanup is complete.
4. Why does malware return after WordPress cleanup?
Malware may return if an attacker still has access, a backdoor remains, a vulnerable component has not been fixed, or compromised credentials are reused. Investigate the underlying cause instead of repeatedly removing only the visible symptoms.
5. Will Google remove the hacked warning immediately after cleanup?
No. Google must re-evaluate the website, and warning updates may take time. If Search Console provides a Security Issues review option, request a review after the reported problems have been properly resolved.
6. Should I change my passwords after a website hack?
Yes, if credentials may have been exposed. Secure the affected accounts, use unique passwords, review unauthorized access, and change credentials in a safe order. Do not forget hosting, FTP/SFTP, and other accounts that could affect the website.
7. When should I hire a WordPress security professional?
Consider professional assistance if you cannot access your website, the infection keeps returning, suspicious code is difficult to identify, Google reports persistent security problems, or the website handles important customer or business data.
Need Help Recovering Your Hacked WordPress Website?
A hacked website can put your content, visitors, reputation, and business operations at risk. The right recovery process should address both the visible symptoms and the underlying security problem.
I offer the following WordPress services:
- WordPress Malware Removal
- WordPress Security Audit & Vulnerability Scan
- WordPress Security Hardening
- WordPress Error Fixing
- WordPress Migration
- WordPress Maintenance
If your website is showing suspicious redirects, unexpected spam pages, unauthorized changes, or other possible signs of compromise, get in touch to discuss the symptoms and the safest next steps.
The goal is to investigate the issue, remove confirmed threats where possible, secure affected access, and verify that the website works correctly after the recovery work.
Related Guides






