Hacked WordPress cleanup checklist: verifying files, database and access

Once a compromised WordPress site is offline and you have saved a clean evidence copy, the next job is methodical cleanup. Rushing to restore an old backup or deleting one obvious spam file almost always leaves a backdoor behind, and the site gets re-infected within days.

In this checklist, we walk through the full post-containment cleanup, verification and hardening steps in order. If you have just discovered the hack and have not yet frozen logs, saved an untouched copy or taken the site offline, start with our first-hour hacked WordPress guide first.

The technical steps below reflect official WordPress, WP-CLI, Google Search Central and OWASP documentation as of 23 November 2026. This guide is practical technical help, not legal advice and not a substitute for an incident-response specialist when payment data or sensitive records are exposed.

Eight-step flowchart for cleaning up a hacked WordPress site, in order: confirm your workspace and evidence copy; verify WordPress core files and root directory; audit plugins, themes, mu-plugins and drop-ins; inspect wp-content/uploads and file permissions; audit the database (users, tokens, options and cron); rotate every secret after cleanup; update and harden before reopening; check Search Console, Safe Browsing and privacy duties.
Cleanup checklist, in order, after the site is offline and an evidence copy has been saved.

1. Confirm your workspace and evidence copy

Before touching files on the server, make sure you are not working from the same environment that leaked the login in the first place.

  • Work from a clean machine: Run an updated malware scan on any computer used by administrators. WordPress.org’s FAQ: My site was hacked and Google Search Central’s malware prevention checklist both warn that local trojans on an owner’s laptop can steal FTP and admin credentials again as soon as you reset them.
  • Use SFTP or SSH, never plain FTP: Plain FTP sends credentials in clear text; connect only over encrypted SSH or SFTP.
  • Keep your forensic copy separate: Do not overwrite or delete the snapshot and server logs you pulled during the first hour. As OWASP’s Logging Cheat Sheet notes, authentication successes and failures, authorization errors and file-upload events are key evidence for figuring out how an attacker got in.

2. Verify WordPress core files and root directory

Start by proving that WordPress core itself matches official upstream code, and look for files that should not exist in the site root.

  • Run WP-CLI checksum verification: If you have SSH and WP-CLI access, run wp core verify-checksums --include-root (documented in wp core verify-checksums). It downloads official MD5 checksums for your installed version from WordPress.org without loading WordPress’s PHP runtime, flags modified core files, and with --include-root warns you about extra non-WordPress files placed in the root directory. Pass --version and --locale if your install uses a non-US locale such as en_CA or fr_CA.
  • Replace /wp-admin and /wp-includes manually if you lack WP-CLI: Download the exact matching WordPress release from WordPress.org and replace the /wp-admin and /wp-includes folders over SFTP. WordPress.org’s hacked-site FAQ specifically advises against relying on the dashboard’s built-in reinstall button during cleanup, because in-place installers overwrite existing files without removing extra backdoor files an attacker added inside those directories.
  • Audit wp-config.php and .htaccess line by line: Open wp-config.php and compare every line against a clean sample. Look for injected include, require, eval, base64-encoded blocks or unfamiliar constants near the top or bottom of the file. Check .htaccess (both in the web root and inside subdirectories) for unauthorized rewrite rules that redirect visitors or block security tools. Save a clean copy of .htaccess before editing and delete any temporary backup files from the server afterward, as Google Search Central recommends.

3. Audit plugins, themes, mu-plugins and drop-ins

Most WordPress compromises enter through an outdated or vulnerable plugin or theme, and attackers frequently plant persistence scripts inside wp-content/.

  • Verify WordPress.org plugins with checksums: Run wp plugin verify-checksums --all (see wp plugin verify-checksums) to check every repository plugin against official WordPress.org checksums.
  • Check commercial and custom code against clean vendor archives: Plugins and themes not hosted in the WordPress.org directory cannot be verified against WordPress.org checksums. Download fresh copies from the vendor or your own Git repository and diff them against what is on the server.
  • Inspect high-value theme files: WordPress.org’s hacked-site FAQ highlights index.php, header.php, footer.php and functions.php because a single injected line in any of them runs on every page request.
  • Check wp-content/mu-plugins/ and drop-ins: Must-use plugins (wp-content/mu-plugins/) execute automatically without appearing in the regular active-plugins toggle list, and drop-in files such as db.php, object-cache.php or advanced-cache.php in wp-content/ run very early in the WordPress boot sequence. Confirm you recognize every file there.
  • Delete unused plugins and themes: WordPress.org’s Hardening WordPress guide stresses removing any plugin or theme you do not actively use—deactivated plugins still sit on disk and can sometimes be called directly.

4. Inspect wp-content/uploads and file permissions

Attackers commonly hide PHP web shells inside wp-content/uploads/ because site owners rarely check image folders and some backup restores bring those files right back.

  • Search uploads for executable scripts: A normal WordPress wp-content/uploads/ directory stores media and documents, not PHP code. Scan it for .php, .phtml, .phar or suspiciously named files (including .htaccess overrides placed inside year/month folders). As OWASP’s File Upload Cheat Sheet explains, attackers routinely bypass naive extension or MIME-type checks, so treat any executable file in an upload folder as hostile until proven otherwise.
  • Block PHP execution in uploads: At the web server level (Nginx location rule or Apache .htaccess inside uploads), deny PHP execution so an uploaded script cannot run even if a vulnerable form later allows it onto disk.
  • Reset file and directory permissions: WordPress.org’s Hardening guide gives standard permissions of 0644 for files, 0755 for directories, and 400 or 440 for wp-config.php where hosting ownership permits—never 0777 world-writable permissions.

5. Audit the database: users, tokens, options and cron

Cleaning files alone fails if the attacker left a rogue administrator, an active API credential, a malicious scheduled task or injected JavaScript in your database. Note that your table prefix may not be wp_—check $table_prefix in wp-config.php (documented in Editing wp-config.php) before running queries.

  • Review every user account and role: Run wp user list (include --network on multisite) or inspect wp_users and wp_usermeta in phpMyAdmin. Delete any account you do not recognize, and verify that existing administrator accounts still belong to your team’s real email addresses.
  • Revoke unknown Application Passwords: Since WordPress 5.6, users can hold 24-character Application Passwords stored in user meta for REST API and XML-RPC integrations. Changing a user’s login password does not automatically clear existing application passwords, so check every privileged user’s profile (or query application passwords via WP-CLI or the REST API) and revoke anything unfamiliar.
  • Check wp_options for tampering: Verify siteurl, home, admin_email, users_can_register, default_role, template, stylesheet and active_plugins. Look for unexpected serialized scripts or redirects hidden in widget, header/footer or theme options.
  • Scan wp_posts for injected markup: Search post_content for suspicious <script>, <iframe>, hidden SEO spam links or newly published spam posts and pages you did not create.
  • Inspect WP-Cron and server cron jobs: Run wp cron event list to look for unfamiliar hooks that re-download payloads or re-create admin accounts on a timer. Check your hosting control panel’s system crontab for the same pattern.

6. Rotate every secret after cleanup

Only after you have verified that core, plugins, themes, uploads and the database are clean should you issue final credentials. WordPress.org’s hacked-site FAQ explicitly instructs owners to change passwords again after confirming the site is clean, because a backdoor still present during the first reset may have captured the new values.

  • Rotate the database password: Create a new database password (or database user) in your hosting panel and update DB_PASSWORD (and DB_USER if changed) in wp-config.php.
  • Replace all WordPress keys and salts: Generate eight fresh keys and salts from WordPress.org’s salt generator and paste them into wp-config.php. This immediately invalidates every active session cookie and forces every logged-in user to re-authenticate.
  • Reset all user passwords: Force new, long, unique passwords for every remaining user account, following WordPress.org’s Reset your password guide.
  • Rotate hosting, SFTP, SSH and DNS credentials: Update your hosting panel login, remove unrecognized SSH public keys from authorized_keys, and check your DNS provider or CDN account for unknown API tokens or added users.

7. Update and harden before reopening

Do not bring the site out of maintenance mode until the underlying hole is patched and basic guardrails are in place.

  • Update everything: Apply the latest WordPress core, plugin and theme updates, and confirm with your host that your PHP version is still receiving security updates. If you never identified which plugin or theme let the attacker in, do not re-enable outdated third-party add-ons without replacing them or verifying their changelog.
  • Disable the built-in file editor: Add define( 'DISALLOW_FILE_EDIT', true ); to wp-config.php so an attacker who reaches the dashboard cannot edit theme or plugin PHP directly from the browser (per Hardening WordPress).
  • Enforce 2FA or passkeys for admins: WordPress.org’s Brute Force Attacks documentation notes that WordPress core does not include two-factor authentication out of the box, so install a reputable 2FA or WebAuthn passkey plugin for all administrator accounts. OWASP’s Multifactor Authentication Cheat Sheet recommends TOTP authenticator apps or hardware-backed authenticators over SMS.
  • Protect login and XML-RPC endpoints: Rate-limit wp-login.php at your CDN/WAF or web server, disable xmlrpc.php if no integration needs it, and eliminate legacy admin usernames.
  • Keep clean, off-server backups: Once verified clean, take a fresh baseline backup stored off the web server so future recovery starts from a known good state.

8. Check Search Console, Safe Browsing and privacy duties

Once the cleaned site returns HTTP 200 properly, verify how search engines and browsers see it—and close the loop on any personal data exposure.

  • Inspect Google Search Console: Run a site:yourdomain.com search to spot spam URLs still in Google’s index, check Search Console’s Security Issues report, and verify that no unknown owner was added to your Search Console property (all covered in Google’s malware prevention guide).
  • Do not request a Safe Browsing review prematurely: Under Google Safe Browsing’s Repeat Offenders policy (updated 19 November 2026), sites that repeatedly bounce between clean and compromised within a short window can be locked out of requesting reviews through Search Console for 30 days. Finish every cleanup and hardening check above before clicking request review.
  • Review privacy and breach obligations: If the hacked site held contact-form submissions, donor details, member accounts or customer records, confirm your reporting and notification duties under PIPEDA or Quebec’s Law 25 in our first-hour hacked WordPress guide, and review Quebec’s Law 25 incident and privacy obligations if you need to maintain a confidentiality-incident register.