Privacy

My WordPress site was hacked: what should I do first?

Contain harmful activity, preserve evidence and recover WordPress safely. Decide when to use your host, a checked backup, free tools or specialist cleanup.

Made by Pagember · Editorial policy

Editorial guidancePublished Updated Sources

The short answer

Contact your host first through its official support channel and ask it to restrict harmful public access while preserving a dated copy of the files, database and logs. Next, secure the hosting, registrar, DNS and recovery mailbox accounts, replace the WordPress keys and salts in wp-config.php, then choose a checked backup or specialist cleanup. Reopen only when the affected URLs, accounts and logs check out clean.

On this page12 sections

If your WordPress site appears to be hacked, protect visitors and regain control before trying to make the homepage look normal. Contact the existing host through its official support channel, record the symptoms, restrict harmful activity and preserve a private copy before destructive cleanup. Choose restoration or specialist cleanup only after you understand the affected accounts and the data you could lose.

WordPress official logo above a conceptual board diagram: Contain, Investigate, Recover.

This guide is for a website you own or are authorized to administer. A store, membership service or site holding sensitive records needs its responsible business and technical people involved early. Do not install a collection of plugins or buy a new host as your first response.

On this page:

  1. Contain active harm with the host
  2. Keep evidence and recovery copies separate
  3. Secure the accounts that control recovery
  4. Choose restoration or cleanup
  5. Use free tools carefully
  6. Correct the entry point and verify recovery
  7. Resolve Google and browser warnings
  8. When specialist help is worth paying for
  9. Keep a short incident handover

First, choose the right response

What you seeDo firstAvoid
Phishing, suspicious checkout code, malicious redirects or downloadsAsk the host to restrict affected public access promptly; involve the responsible payment or data provider where applicableLeaving harmful pages available while waiting for a perfect backup
Only a broken page, slow site or failed loginCheck the host's status and recent authorized changes; collect details and investigate possible compromiseTreating a symptom alone as proof of a hack or deleting files to experiment
Unknown administrators, altered hosting access or several affected sitesEscalate to the host and a qualified incident handler; secure the wider account boundaryAssuming one WordPress password reset secures every service
Infection returns after a restore or scanKeep the site contained and investigate surviving access or persistenceRepeating the same restore or declaring success from another empty scan
You cannot access the hosting account or recovery mailboxUse the provider's account-recovery process from a trusted device and reachable contact addressChanging DNS blindly or giving an unsolicited caller account access
Use the observed problem to choose a safe first action

A screenshot of a warning, its address, the time and timezone, and an account-change alert are useful starting facts. A slow page alone is ambiguous. WordPress recommends recording concrete symptoms and actions so support can investigate the actual incident. Use the provider's known website or saved contact details; do not follow a threatening email's login link.

1. Contain active harm with the host

Tell support which site and account are affected, what visitors are experiencing and whether there are orders, sensitive forms or outgoing spam. Ask what they can restrict now, what remains running, and how to preserve the current state and available logs. Record who authorized the change and how access can be restored. If harm is active, contain it immediately; preservation and investigation can proceed alongside that work.

A maintenance page inside WordPress may rely on compromised code. Ask the existing host about host-level restrictions that isolate the affected web paths while preserving the account, logs and other necessary services. Verify alternate addresses and access with the host; do not guess dashboard-specific steps.

Restricting web requests does not establish that scheduled jobs, file access, other sites or a compromised hosting account have stopped. Explain any account-level symptoms to the host. If a CDN still serves affected content, include its cached copies in the containment discussion. A firewall or a hidden login URL alone does not remove an existing infection.

2. Keep evidence and recovery copies separate

Before replacing or deleting material, ask the host or incident handler to preserve a dated copy of the affected files, database and available access, error and account logs. Keep an action timeline as changes are made. Note the source account/site, capture time and timezone, available date range and who made the copy. If there is a dispute, suspected data theft or a formal investigation, ask the qualified responder how evidence should be captured and handled.

An infected copy is useful for investigating changes or recovering legitimate content; it is not a clean restore point. Store it privately outside the public website tree, limit access, and do not run its code on your everyday computer or upload its database to a public scanner or support forum. Configuration and database exports can contain credentials and personal records.

The WordPress file-backup documentation explains why downloading the website folder normally misses the database. Capture uploads, plugins, themes and relevant configuration, plus the separate database export using the host's supported process. Do not guess the database name or overwrite another installation. Preserve account-level information with the host when the incident extends beyond WordPress.

Logs can disappear through rotation. Request the available access, error, authentication and relevant change logs promptly from the existing host. Record their time zone, coverage and missing periods. A short window cannot prove when the compromise began.

3. Secure the accounts that control recovery

Identify the hosting owner, WordPress administrators, domain registrar, active DNS provider and recovery/business mailbox. These may belong to different services and people. If an attacker controls the mailbox receiving password resets, replacing only the WordPress password leaves a recovery problem. Use a known clean, updated device and the providers' official recovery routes; involve the authorized owner when you lack the required access.

Rotate credentials suspected of exposure, remove unauthorized access and revoke active sessions through the relevant provider's controls. Review hosting/SFTP/SSH access, privileged WordPress users and connected integrations with the responsible administrator. Preserve useful account-change evidence; do not remove a legitimate collaborator just because their username is unfamiliar. Set up supported multi-factor authentication and safe recovery methods after securing ownership.

Invalidate WordPress login cookies as well as changing passwords. Have the authorized administrator follow the WordPress hacked-site instructions to replace the authentication keys and salts in wp-config.php with fresh generated values. This logs out people using the old cookies, including you; confirm that legitimate administrators can sign in again. Use the host or specialist if you cannot safely edit the configuration. This does not revoke application passwords or access to separate services.

WordPress application passwords are separate integration credentials. Review and revoke exposed or unneeded ones; browser logout does not replace that check. Hosting API tokens, SSH keys and mail-provider access require their own review. Database-password changes need a coordinated configuration update; do not change one side and strand the site. Ask the host or specialist to handle a step you cannot safely complete.

Also check Search Console Settings → Users and permissions with the legitimate property owner. Remove unauthorized access and inspect Unused ownership tokens: a removed verified owner can regain access while their token remains. Follow the removal instructions for that token and preserve legitimate ownership. Tokens can also support other Google services, so identify their purpose before deleting a file, tag or DNS record.

Do the urgent access work early. After cleanup, reassess and replace credentials that may have been exposed while malicious code was still present. Record the access you revoked and confirm legitimate integrations again. Our domain-account ownership guide helps map control, while the domain and email guide explains why changing DNS can disrupt a separate mailbox. Do not transfer the domain or replace MX records as a generic malware fix.

4. Choose restoration or cleanup around the data at risk

SituationUseful routeCheck before replacing anything
A plausible earlier backup existsInspect it and rehearse restoration in an isolated recovery environmentIts date, files/database coverage, infection indicators and the newer orders or content it omits
No trustworthy restore point or important newer recordsPreserve the current state and use a competent cleanup/recovery operatorWhat can be repaired or selectively recovered without reintroducing infected material
The hosting account or multiple installations are affectedCoordinate broader recovery with the host and incident handlerOther sites, account access, scheduled tasks, email and the consequences of an account restore
Recovery choices depend on evidence, access and recent legitimate changes

Yesterday's backup may already contain an older infection. A date before you noticed the symptom is only a clue, not proof that it predates compromise. The WordPress backup handbook treats files and database as a matching recovery set. Use our restore-rehearsal guide to check recovered content and workflows rather than trusting a completed download.

Backups kept outside the hosting account are easier to trust after a compromise, because an attacker with server access cannot alter them. BlogVault stores WordPress backups on its own servers with dated versions, so you can open an earlier version on a staging copy and inspect it before anything touches the live site. Its selective restore can bring back chosen files or tables while newer orders and posts stay in place.

Recover suspected material only in a suitably isolated environment arranged by the host or specialist, with its own storage and database. Keep real emails, payments, webhooks and scheduled tasks disabled. Password protection or noindex alone does not prevent copied malicious code from running or making outbound connections. A beginner should not launch an infected clone on an ordinary laptop to see what happens.

A partial restore may miss malicious files or scheduled tasks outside its scope. A full account restore can also replace newer legitimate website data or email. Agree the scope first and preserve new records. Reconcile recent orders with the responsible system; do not replay real transactions as a restore test.

5. Use free tools carefully; stop at your skill boundary

Start with the host's included help and tools. A capable administrator may combine preserved copies, documented scans, file comparisons, account review and controlled restoration without buying another subscription. If you cannot distinguish an authorized customization from injected code, or cannot recover an accidental deletion, stop the destructive part and seek help.

A scanner and firewall perform different jobs from a complete incident investigation. Ask which files, tables, users and scheduled tasks were inspected, what was excluded and who acts on the findings. Do not install several overlapping security plugins during an incident without a compatibility and rollback plan.

A repair action can overwrite legitimate customizations along with suspicious files. Read each finding, preserve the original and understand the proposed change. Do not bulk-delete flagged files, remove the uploads folder or search-and-replace the database based only on a suspicious string or timestamp.

Ask the operator to review the affected scope: privileged users, database content/settings, core and components, must-use plugins, uploads, configuration, scheduled tasks, other installations and account access where relevant. WP-CLI core checksums can help an administrator compare the selected core version and locale; they do not clear the database, every plugin/theme or the hosting account. This article does not ask beginners to run shell commands.

Tools have different inspection boundaries. A clean file result does not establish that the database, accounts or scheduled tasks are clean. Ask what was checked, skipped or inaccessible, especially when redirects or unwanted accounts persist.

6. Correct the entry point and verify recovery

Removing the visible spam page is insufficient if the exposed account or vulnerable component remains. Ask for a clear record of the likely entry route, what was corrected and any uncertainty that remains. If the cause is unknown, agree additional investigation and monitoring rather than inventing certainty. Replace affected software from trusted sources, remove unnecessary components and test supported updates with the responsible operator. WordPress's hardening guidance treats server, application, device and access controls as connected responsibilities.

Before reopening, record checks of recovered pages, media, administrator access, forms and relevant commerce workflows using safe test procedures. Include previously affected URLs, redirects, accounts, logs and component integrity. Confirm that mail, DNS and other sites still operate as intended. An empty scan and a normal-looking homepage are only parts of that evidence.

After restoration, review exposed credentials and revoked integrations again, confirm the current patched configuration, and create a fresh recovery copy only after the recovered state has been assessed. Agree who receives alerts, what they inspect and when the next review occurs. Returning symptoms mean containment and investigation resume, not that the same restore should be repeated indefinitely.

Include authentication configuration in the restored-state check: a restored configuration can contain earlier keys and salts. Have the operator confirm the intended current configuration, invalidate old login cookies where needed and check legitimate sign-in again.

7. Resolve external warnings through the right channel

If Google reports security issues, use the verified site's Search Console Security Issues report. Its example URLs are not a complete inventory. Address every reported issue type throughout the affected site, then request security review with the fixes described. A scanner cannot submit evidence of your whole recovery simply by displaying a green result.

Manual Actions needs its own review

Check the Manual Actions report separately. If it lists an action, follow that action’s scope and fix all affected pages before requesting review there. Explain the issue, changes and verification. A Security Issues review is a different process; neither a submitted request nor a clear report replaces checks of the recovered website.

Separate legitimate pages from attacker-created URLs

For an important legitimate page, use URL Inspection and its live test to inspect the current response, rendered page and index restrictions. Compare live information with the indexed version. A valid live result is not an indexing guarantee or a security clearance, and does not check Manual Actions or every possible indexing issue.

When the page is recovered and intended to be public, you can request indexing for a few important URLs, or submit a clean sitemap for many URLs. Repeated requests do not make a URL crawl faster. Monitor the relevant reports; a request does not guarantee inclusion, restored rankings or traffic.

For an attacker-only spam URL with no legitimate replacement, remove the injected content and have the server return an actual 404 or 410 status, as Google’s response guidance explains. Remove that URL from your sitemap. A normal-looking “not found” page returning 200 is insufficient; do not redirect unrelated spam URLs to the homepage. Preserve a legitimate page at its proper address instead of deleting it with the spam.

Temporary hiding is not cleanup

If an attacker-created URL needs urgent hiding from Google Search, an authorized owner can consider the Removals tool. Its temporary block lasts about six months and does not remove the content from the website. Check the exact URL or prefix carefully; avoid hiding the whole site or legitimate pages you want indexed. Complete the underlying removal or repair. Blocking with robots.txt alone is not permanent removal from Search.

Other host, browser or security-provider warnings have their own processes. Follow those providers' instructions after remediation. Do not tell visitors to ignore warnings or promise a removal date, restored ranking or immediate traffic recovery. A clean Search Console report is not a universal security certificate.

When specialist help is worth paying for

Seek qualified help promptly for suspected customer/payment-data exposure, account takeover, recurring infection, multiple affected sites or recovery beyond your skills. Follow the affected providers' incident procedures and obtain appropriate privacy, legal or payment-security advice about assessment and notifications. This guide cannot determine who must be notified or set a deadline for your circumstances.

Before paying, ask who performs the work, which account/sites and database are included, what access they need, how evidence and backups are handled, and what constitutes completion. Confirm current availability, exclusions, price and follow-up directly. Give scoped, revocable access through a secure channel; do not post credentials in public support threads.

Software support and qualified incident recovery are different scopes. If the current host or administrator cannot investigate and repair the affected system, obtain a written cleanup scope directly. The Wordfence and Sucuri comparison shows how their cleanup services differ from their plugin and firewall plans. For prevention read the security and backup budget guide; for recovery read the restore checklist.

Keep a short incident handover

Maintain a private record with: observed symptom and time/timezone; affected account/site; containment action and owner; evidence-copy location and access; chosen recovery point and data losses to reconcile; corrected access/component; checks and their results; outstanding warnings; and the next monitoring review. Leave unknown items explicitly open for the responder. Keep secrets and customer records out of the general checklist.

Copy the following fields into a private incident note and fill in the bracketed parts.

  • Time and timezone: [date/time/zone]
  • Observed symptom and affected site/account: [what happened; where]
  • Action, authorization and owner: [what changed; who approved; who performed it]
  • Preserved evidence location and scope: [private reference; files/database/log period; who can access]
  • Verification result and limits: [check; observed result; what was not checked]
  • Next action, responsible person and check time: [open item; owner; planned review]

The useful outcome is controlled access, an explained recovery decision and documented checks of the recovered service. Continue using the existing provider where it meets that need; purchase specialist work when there is a clear responsibility or capability gap. Once the site is stable, publish a security.txt contact file so researchers can report the next problem to you, and keep the plugin vulnerability alert routine for future warnings.

If the site looks normal, can you reopen it?

A pass on the homepage tells you little about the checkout route or the job that syncs orders. Make reopening a decision someone owns. Write down which public functions can return, what evidence supports each one, and what event would take it offline again. A content-only site and a store can reopen in different stages if the platform lets you isolate payment or account routes.

Evidence to agree before each service returns
ServiceWhat to verifyWhen to keep it closed
Public pagesPreviously affected URLs meet the expected response and redirect behavior from a fresh browser. A normal request also produces the expected records in your monitoring.An unexpected redirect, injection or previously removed administrator returns.
Customer forms or accountsA synthetic test reaches the intended destination once. Recovered accounts have the expected permissions and authorized recovery routes.Notifications or access checks are still routed to an unknown destination or owner.
Orders and paymentsThe payment operator confirms when it is appropriate to resume. With test data, verify the intended payment destination, a successful and a declined order, and that one order only is recorded.Payment scripts, provider destinations or order reconciliation are unresolved.

Keep an owner and review time for any function you reopen. If a stop signal appears, reapply the documented restriction and add the observation to the incident record with its timestamp. For a store, use the separate checkout skimming investigation to check payment-page scripts and the recovery drill to practice restoring from an independent copy.