WordPress Security Hardening and Recovery Checklist: Practical Steps for Site Owners

Website security directly affects search visibility, user trust, and Google AdSense eligibility: compromised WordPress sites routinely suffer injected spam redirects, hidden cloaked pages that trigger Google Safe Browsing warnings, and sudden deindexation. Effective hardening avoids heavy bloat or fear-driven security plugins that break legitimate bots—relying instead on strict access hygiene, integrity checks, and a clear recovery sequence.

Baseline Hardening Settings Every WordPress Site Should Verify

Security ControlRecommended ConfigurationPractical Purpose
File PermissionsDirectories 755, standard files 644, wp-config.php tightened to 600 or 640Prevents unauthorized local processes from reading database credentials or modifying core templates
User Accounts & 2FAEnforce strong unique passwords + TOTP 2FA on Administrator accounts; remove unused admin usersBlocks credential-stuffing attacks against wp-login.php and XML-RPC endpoints
API & MCP IntegrationsReview Application Passwords and OAuth grants periodically; revoke unused integrationsLimits remote REST API write tokens strictly to active, trusted workflows
HTTP Security HeadersEmit X-Content-Type-Options: nosniff, Referrer-Policy, and safe X-Frame-Options: SAMEORIGINMitigates MIME-type sniffing and clickjacking without breaking legitimate ad/analytics frames

Step 1: Verify Core and Plugin File Integrity Using WP-CLI Checksums

Before assuming an unexplained file change or slow dashboard means a plugin bug, verify whether core WordPress files match official cryptographic hashes from WordPress.org:

# Compare local WordPress core files against official WP.org checksums
wp core verify-checksums

# Verify WordPress.org repository plugins cleanly
wp plugin verify-checksums --all

Any unexpected mismatch inside wp-admin/, wp-includes/, or unrecognized .php files placed inside wp-content/uploads/ requires immediate inspection before cleaning or restoring from a verified backup.

Step 2: Post-Incident Triage and Safe Recovery Sequence

If unauthorized modifications, spam drafts, or suspicious redirects are detected, treat recovery as a disciplined containment pipeline rather than random file deletion:

  1. Capture Forensic Evidence First: Export a copy of recent access logs and database snapshot before overwriting files so you can identify the entry vector (for example, an outdated plugin vulnerability or compromised password).
  2. Rotate All Credentials & Security Salts: Change hosting panel, SSH/SFTP, database, and Administrator passwords, revoke active WordPress sessions across all users, and regenerate WordPress authentication keys and salts inside wp-config.php.
  3. Restore Clean Code from Verified Sources: Reinstall WordPress core files and repository plugins cleanly rather than trying to hand-edit potentially obfuscated malware backdoors, then reapply verified custom child theme code.
  4. Audit Search Visibility & URL Hygiene: Check for unauthorized spam posts, rogue Search Console HTML verification files in the webroot, modified robots.txt rules, or injected <script> tags inside database posts or theme headers.

Step 3: Protecting Crawler & AdSense Access During Hardening

Overly aggressive firewall or anti-bot settings frequently cause unintended SEO damage. Specifically, avoid blocking legitimate Googlebot or Mediapartners-Google IP ranges, avoid setting X-Frame-Options: DENY globally if it interferes with embedded previews, and confirm interactive tools and analytics still render cleanly using How to Verify Googlebot and Diagnose Crawling Errors.

After recovery, inspect Google Search Console under Security & Manual Actions and re-check your XML sitemaps and robots.txt rules to confirm search engines see a clean domain.

Limitations & Common Hardening Pitfalls

  • False Confidence from Changing Login URLs Alone: Obscuring wp-login.php does not protect outdated plugins or weak admin passwords; enforce updates, least privilege, and 2FA first.
  • Leaving Untrusted .php Execution Enabled Inside Uploads: Most modern WordPress hosts support blocking direct PHP execution inside wp-content/uploads/ cleanly via server rules—verify your rule does not break valid WebP/SVG/image delivery.

Official Documentation & References

Ibrahim Salah
ABOUT THE AUTHOR

Ibrahim Salah

Founder & Lead Technical Editor

Ibrahim Salah is the founder of Caesar Pro. He focuses on developing practical SEO resources and website optimization tools for website owners and digital publishers. Caesar Pro's editorial resources emphasize clear technical explanations, practical examples, and references to official web documentation.

Comments & Discussion