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.

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 inwp 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-rootwarns you about extra non-WordPress files placed in the root directory. Pass--versionand--localeif your install uses a non-US locale such asen_CAorfr_CA. - Replace
/wp-adminand/wp-includesmanually if you lack WP-CLI: Download the exact matching WordPress release from WordPress.org and replace the/wp-adminand/wp-includesfolders 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.phpand.htaccessline by line: Openwp-config.phpand compare every line against a clean sample. Look for injectedinclude,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.htaccessbefore 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(seewp 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.phpandfunctions.phpbecause 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 asdb.php,object-cache.phporadvanced-cache.phpinwp-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
uploadsfor executable scripts: A normal WordPresswp-content/uploads/directory stores media and documents, not PHP code. Scan it for.php,.phtml,.pharor suspiciously named files (including.htaccessoverrides 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.htaccessinsideuploads), 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
0644for files,0755for directories, and400or440forwp-config.phpwhere hosting ownership permits—never0777world-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--networkon multisite) or inspectwp_usersandwp_usermetain 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_optionsfor tampering: Verifysiteurl,home,admin_email,users_can_register,default_role,template,stylesheetandactive_plugins. Look for unexpected serialized scripts or redirects hidden in widget, header/footer or theme options. - Scan
wp_postsfor injected markup: Searchpost_contentfor 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 listto 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(andDB_USERif changed) inwp-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 );towp-config.phpso 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.phpat your CDN/WAF or web server, disablexmlrpc.phpif no integration needs it, and eliminate legacyadminusernames. - 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.comsearch 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.