Discovering that your WordPress website has been hacked can be stressful. You might find unfamiliar pages appearing in Google, see unexpected redirects, lose access to your WordPress dashboard or receive a warning from your hosting provider.
Whatever the symptoms, the priority is to protect your website, prevent further damage and identify how the attacker gained access. Simply changing your password or deleting a suspicious file may not be enough. A proper recovery process should identify the infection, remove malicious code and address the security weakness that allowed the attack.
1. How to recognise a hacked WordPress website
Not every website problem is caused by hackers, but certain warning signs deserve immediate investigation. Some attacks are obvious, while others remain hidden and affect visitors or search engines without changing the homepage.
Common signs include:
- Unexpected redirects: Visitors are sent to unfamiliar websites, advertising pages or suspicious downloads.
- Unknown pages: Spam pages appear on your domain, sometimes targeting gambling, adult content or unrelated products.
- Unfamiliar administrator accounts: New WordPress users appear with administrator permissions.
- Changed website content: Your homepage, posts or other pages contain text or links you did not add.
- Security warnings: Your browser, hosting provider or Google reports suspicious activity.
- Unexpected files: Unknown PHP files or modified core files appear in your website directories.
- Performance problems: Your website becomes unusually slow or uses excessive server resources.
- Email issues: Your hosting account is used to send spam messages.
Some infections are designed to show different content to search engines and ordinary visitors. This means your website may appear normal when you visit it directly, even though Google detects spam or malicious pages.
If you notice any of these symptoms, avoid making random changes before understanding the problem. Start with the immediate response steps below.
2. What to do immediately after discovering a hack
Your first priority is to limit the damage. The exact response depends on the type of attack, but the following steps provide a sensible starting point.
Contact your hosting provider
Tell your hosting provider that you suspect a security incident. Ask whether they have detected malware, suspicious file changes or unusual account activity. They may be able to isolate the website, provide security logs or identify affected files.
Restrict access if necessary
If the website is actively redirecting visitors, distributing malicious files or affecting other sites on the same hosting account, temporary restrictions may be necessary. Your host or security professional can advise whether the website should be taken offline or placed behind a maintenance page while the investigation takes place.
Secure important accounts
From a clean, trusted device, change passwords for your hosting account, WordPress administrators, domain registrar, FTP or SFTP accounts and database access where appropriate. If the same password was used elsewhere, change it on those services too.
Do not use a device you suspect is infected to manage your website. Otherwise, saved credentials or new passwords could be exposed again.
Preserve evidence and backups
Before deleting files or restoring a backup, preserve a copy of the affected website and relevant logs if possible. These records can help identify how the attack happened. Do not assume that every backup is clean, because an infection may have existed for weeks before it was discovered.
3. How WordPress websites commonly get hacked
WordPress itself is widely used and can be secured effectively. However, a WordPress website is made up of several components, including its core software, themes, plugins, hosting environment and user accounts. Weaknesses in any of these areas can create opportunities for attackers.
Outdated plugins and themes
Plugins and themes can contain security vulnerabilities. If a vulnerability is discovered and a security update becomes available, websites running the affected version may become targets.
Keeping software updated is one of the most important maintenance tasks. Remove plugins and themes that are no longer needed rather than leaving inactive software installed indefinitely.
Weak passwords and compromised accounts
Simple passwords, reused credentials and unsecured administrator accounts make unauthorised access easier. Attackers may also gain access through a compromised email account or hosting login.
Use unique passwords, enable two-factor authentication where available and limit administrator permissions to people who genuinely need them.
Untrusted themes and plugins
Downloading premium themes or plugins from unofficial websites can introduce malicious code. Some unofficial packages contain hidden backdoors that give attackers access even when the software appears to work normally.
Use software from trusted developers and reputable marketplaces. Keep a record of the licences and sources for the extensions installed on your website.
Insecure hosting or file permissions
Poorly configured hosting, outdated server software and overly permissive file permissions can increase the risk of an attack. If several websites share the same hosting account, a compromised site may also create risks for other installations.
Choose a hosting provider that offers appropriate server security, supported PHP versions, backups and a clear process for responding to incidents.
4. How to clean a hacked WordPress website
Removing malware properly requires more than deleting the files that look suspicious. Attackers often leave multiple entry points so they can regain access after an initial cleanup.
A thorough recovery process should include the following steps.
Scan the complete website
Use a reputable security scanner to identify suspicious files, modified WordPress core files, malware signatures and unexpected code. A scan can help locate problems, but automated tools may not identify every infection.
Inspect WordPress files
Compare WordPress core files with clean copies of the same version. Investigate unexpected PHP files, modified configuration files and suspicious code in directories that should not contain executable files.
Pay particular attention to common entry points such as wp-config.php, .htaccess, the uploads directory, active themes and plugins. However, do not assume that a file is malicious simply because it is unfamiliar. Some legitimate plugins create additional files.
Review administrator accounts
Check the WordPress user list and remove accounts that are confirmed to be unauthorised. Review existing administrator permissions and check whether any legitimate accounts have been modified.
Replace compromised software
Download clean copies of WordPress core, themes and plugins from trusted sources. Replace compromised files rather than attempting to repair every suspicious line manually. Preserve legitimate configuration and custom development work where necessary.
Check the database
Malicious code can be stored in the database as well as in website files. Review suspicious administrator records, unexpected content, injected links and modified settings. Database cleanup should be handled carefully because removing the wrong records can damage website functionality or delete legitimate content.
Remove the original entry point
Cleaning the visible malware is not enough if the vulnerability remains. Identify and fix the weakness that allowed the attacker to enter, whether it involved an outdated plugin, compromised password, vulnerable theme or insecure hosting configuration.
For a heavily infected website, rebuilding from clean WordPress files and restoring verified content may be safer than trying to repair every affected component individually.
5. Restoring your website from a backup
If you have a reliable backup from before the attack, restoring it may be the quickest way to recover your website. However, restoration should be part of a security recovery process rather than the only action taken.
Before restoring, check:
- When the backup was created and whether it predates the infection.
- Whether the backup includes website files and the database.
- Whether the backup itself has been scanned or otherwise verified.
- Whether the vulnerability that caused the attack has been fixed.
- Whether important customer information or recent website updates need preserving.
After restoration, update WordPress, themes and plugins, replace compromised credentials and review administrator accounts. If the original security weakness remains, the website could be hacked again.
For websites handling orders, customer accounts or enquiries, take particular care to preserve legitimate recent data. Restoring an old database without checking what has changed could result in lost orders or customer information.
6. How to secure your WordPress website against future attacks
Once your website has been cleaned, put a consistent security routine in place. No website can be guaranteed to be completely immune to attacks, but sensible security measures can reduce risk and make recovery easier.
- Keep everything updated: Update WordPress core, plugins and themes, testing important functionality after major changes.
- Use strong passwords: Give every administrator a unique password and avoid sharing login details.
- Enable two-factor authentication: Add another verification step to important accounts.
- Remove unused software: Delete inactive plugins and themes that are no longer required.
- Use regular backups: Keep automated backups and store copies separately from the live hosting account.
- Install reputable security tools: Use a suitable firewall or malware monitoring service where appropriate.
- Limit user permissions: Give each user only the access needed for their role.
- Use secure connections: Ensure your website and administration access use HTTPS.
- Monitor activity: Review login activity, unexpected file changes and security alerts.
- Choose reliable hosting: Look for supported software, server-level protection and a clear backup and recovery policy.
Also establish a maintenance schedule. Security is not a one-time installation task. Regular checks help identify outdated software, failed backups and suspicious changes before they become larger problems.
7. What to check after your website is recovered
Once your website is clean and accessible, test it as a visitor and as an administrator. A successful malware cleanup does not automatically mean every part of the website is working correctly.
Use this checklist:
| Area | What to verify |
|---|---|
| Homepage and pages | Check that content, images and navigation display correctly. |
| WordPress access | Confirm that only authorised users have access. |
| Forms | Submit test enquiries and confirm email notifications arrive. |
| WooCommerce | Test products, cart, checkout and order notifications if applicable. |
| Redirects | Check that visitors are not sent to unexpected websites. |
| Search visibility | Review Google Search Console for security issues and unwanted indexed pages. |
| Backups | Confirm that new backups complete successfully. |
| Monitoring | Enable appropriate security alerts and review them regularly. |
If Google has flagged your website, review the relevant security or manual action reports in Search Console. After fixing the issue, follow Google’s instructions for requesting a review where applicable. Removing malware from your server does not necessarily remove warnings or spam pages from search results immediately.
How PinkCity Web Solutions can help
PinkCity Web Solutions provides WordPress development, maintenance and technical support for businesses and agencies. Our experience includes working with WordPress, PHP, custom CSS, Elementor, Bricks Builder and website functionality, helping clients resolve technical problems and keep their websites working correctly.
If your website has been compromised or is showing suspicious behaviour, we can discuss the technical investigation, cleanup and recovery work required. Visit our WordPress development services page or contact us to discuss the issue. For active security incidents, contact your hosting provider immediately as well.
Related reading: WordPress maintenance checklist · How to hire a WordPress developer
Frequently asked questions
Can a hacked WordPress website be recovered?
Yes, many hacked WordPress websites can be cleaned and restored without rebuilding everything from scratch. The recovery process depends on the extent of the infection, the availability of clean backups and whether the original security weakness can be fixed.
Will changing my WordPress password remove malware?
No, changing your password can help secure a compromised account but it does not remove malicious files or database injections. You should also investigate the infection, check other access points and secure related hosting accounts.
How long does it take to clean a hacked WordPress website?
The time required depends on the number of affected files, the complexity of the website and how the attacker gained access. A simple incident may be resolved relatively quickly, while a heavily compromised website can require a detailed investigation and recovery process.
How can I prevent my WordPress website from being hacked again?
Keep WordPress, plugins and themes updated, use strong passwords, enable two-factor authentication and maintain reliable backups. Regular security monitoring and removal of unused software also help reduce the risk of another incident.
