Quick answer
If your WordPress site is hacked, immediately isolate the environment to stop the damage. Within the first 60 minutes, take a complete backup snapshot, restrict access by blocking suspicious IPs and changing database credentials, document all symptoms, and contact your host. Avoid deleting files or restoring untested backups prematurely, as this destroys forensic evidence and can cause total site failure.
What Are the Immediate Steps to Contain a WordPress Breach?

Discovering a security breach on your WordPress site triggers immediate panic. However, the actions you execute during this "Golden Hour" dictate whether the incident remains a contained event or escalates into a catastrophic operational failure. Your primary objective in the first 60 minutes is containment and evidence preservation, not immediate eradication.
To secure your environment systematically, follow this immediate containment checklist:
- Preserve Evidence: Take a complete, uncompressed backup snapshot of your entire filesystem and database before modifying any files.
- Restrict Access: Block suspicious IP addresses at the server level and temporarily place the site in maintenance mode.
- Record Symptoms: Document the exact time of discovery, visible redirect URLs, defacement screens, or error messages.
- Contact Your Host: Notify your hosting provider's security team to check if neighboring environments on the same server are compromised.
Why Is Destructive Cleanup the Biggest First-Hour Mistake?
When administrators discover unfamiliar files like wp-secures.php, their immediate impulse is to delete them. This is a critical error. Attackers frequently weave malicious execution commands into core infrastructure dependencies. Indiscriminate deletion within /wp-admin or /wp-includes often triggers fatal PHP errors, resulting in a total application crash.
Furthermore, hasty deletions destroy the digital breadcrumbs required to identify the entry vector. If you do not patch the underlying vulnerability, the attacker will simply exploit the same entry point to reinfect the site. This is why automated security plugins often fail, highlighting why cleaning files is not enough to secure a compromised environment.
Another common pitfall is the premature restoration of untested backups. Modern malware often operates in a dormant state for weeks before executing its payload. Reverting to a backup from three days ago may simply reinstall the attacker's backdoor alongside the unpatched vulnerability, resetting your incident response timeline to zero.
How Do You Conduct a Post-Containment Forensic Investigation?
Once the environment is isolated, you must transition to a systematic forensic audit. This phase establishes a definitive timeline of the intrusion and identifies how the attacker gained access. Without this analysis, any cleanup attempt is merely temporary.
Forensic analysts must cross-reference three primary data sources: web server access logs, filesystem modification timestamps, and WordPress application logs. Access logs are particularly valuable. By filtering logs for suspicious HTTP POST requests, you can pinpoint the exact moment of compromise.
Look for these specific indicators during your log analysis:
- Repeated
POSTrequests directed at unexpected endpoints, such as static directories like/wp-content/uploads/. - Unusually large payload deliveries to
/wp-admin/admin-ajax.php. - The creation of unauthorized administrator accounts, which requires a specialized guide on how to investigate suspicious administrative account creation in WordPress.
Database forensics is also vital. Attackers frequently exploit the wp_options table, injecting malicious code into the active_plugins array or embedding payloads into autoloaded transients. Because autoloaded options load into memory on every page view, they provide a highly resilient mechanism for silent malware execution.
Eradication and Recovery: Restoring Your Site Safely
- 1Minutes 0-60: Containment
Isolate the environment, take a snapshot backup, restrict access, and document symptoms.
- 2Hours 1-4: Investigation
Analyze web server logs, filesystem timestamps, and database transients to find the entry vector.
- 3Hours 4-12: Eradication
Replace core files, plugins, and themes from fresh sources; surgically sanitize the database.
- 4Hours 12-24: Recovery
Verify site integrity, clear caches, submit search console requests, and notify affected parties.
- 5Post-Incident: Hardening
Deploy a Web Application Firewall (WAF), enforce 2FA, and establish continuous activity monitoring.
Based on industry-standard incident response frameworks and WordPress security best practices.
The most secure method for eradicating filesystem malware is a complete, fresh replacement of the WordPress core. Utilizing an SFTP client, delete the existing /wp-admin and /wp-includes directories entirely. Then, upload clean copies downloaded directly from the official WordPress repository.
Do not rely on the dashboard "reinstall" button. Standard installers only overwrite existing files; they do not delete newly introduced malicious files hidden within the directory structure. Apply this same rigorous methodology to your plugins and themes. Delete every active plugin and reinstall them from verified sources.
For commercial platforms, maintaining data integrity during this process is paramount. This is crucial when evaluating if WordPress is secure enough to handle customer data during an active security crisis. If database tables are compromised, execute targeted SQL queries to purge injected scripts, base64 strings, and malicious iframes.
Regulatory Compliance and Agency Incident Protocols
A security incident on a commercial WordPress site is a profound legal and operational liability. If your site processes personal data of users within the European Union, the General Data Protection Regulation (GDPR) mandates strict notification protocols under Article 33.
The regulatory clock begins ticking the moment you establish a reasonable degree of certainty that a breach has occurred. You cannot delay notification while waiting for a full forensic investigation to conclude.
| Compliance Action | Regulatory Expectation (GDPR Article 33 & 34) | Common Critical Misstep |
|---|---|---|
| Supervisory Authority Notification | Must occur within 72 hours of awareness if a risk to individuals exists. | Waiting for the forensic investigation to fully conclude before initiating notification. |
| Information Provided | Nature of the breach, approximate subjects affected, contact point, and proposed mitigations. | Assuming all information must be available immediately; phased reporting is explicitly allowed. |
| Data Subject Notification | Communicated without undue delay if the breach poses a high risk to individual rights. | Using overly technical jargon instead of clear, plain language describing protective steps. |
| Internal Documentation | All breaches must be recorded in an internal register detailing facts, effects, and remedial actions. | Failing to document minor incidents, leading to compliance failures during audits. |
For digital agencies, managing client communication is as critical as technical remediation. Establish a pre-defined communication chain using a centralized status page updated at regular intervals. Focus on actionable insights—such as incident start time, overall impact, and resolution steps—while avoiding technical jargon.
If the breach exceeds your internal capabilities, do not hesitate to seek professional assistance. Engaging a specialized hacked WordPress site cleanup service ensures that both filesystem and database vulnerabilities are permanently resolved under strict service level agreements.
Frequently asked questions
What should I do immediately after discovering my WordPress site is hacked?
Take an immediate backup snapshot of your filesystem and database to preserve evidence. Then, restrict access by blocking suspicious IPs, placing the site in maintenance mode, and changing database credentials. Do not delete files or restore old backups until you have secured this snapshot.
Why is deleting suspicious files right away a mistake?
Attackers often inject malicious code into critical core files. Deleting these files without a clean reference copy can cause fatal PHP errors and crash your site. Furthermore, deleting files destroys forensic evidence, making it impossible to identify and patch the initial entry vector.
How long do I have to report a data breach under GDPR?
Under GDPR Article 33, you must notify the competent supervisory authority within 72 hours of becoming aware of the breach, unless the breach is unlikely to result in a risk to the rights and freedoms of natural persons.
