When you build client applications for years, you start believing your personal blog is safe because you keep core files updated and run a strong password. Then I ran a full, unforgiving WordPress security audit on my own live production site—and what I uncovered in the database, REST endpoints, and user tables genuinely shocked me.
Within twenty minutes of inspecting server logs and database rows, I found 825 spam subscriber accounts silently sitting in my users table, exposed author enumeration routes leaking admin usernames, and unguarded AJAX actions. Improving WordPress security is never a “install one plugin and forget it” checkbox; it requires systematic inspection of every layer from DNS edge rules down to PHP theme templates.

Live WordPress Security Audit: Key Findings Summary
What my own audit uncovered on a real, active WordPress site—and the exact fixes applied to lock it down.
- Gap #1 (Silent User Bloat): Open registration had allowed 825 automated bot accounts to register as subscribers over time.
- Gap #2 (REST Enumeration): Unauthenticated requests to
/wp-json/wp/v2/usersexposed login slugs to brute-force scanners. - Gap #3 (Missing HTTP Headers): Absence of strict
X-Frame-Options,X-Content-Type-Options, andReferrer-Policyheaders. - Gap #4 (Unfiltered Form Inputs): Custom newsletter and contact AJAX handlers lacked strict rate limiting and origin verification.
Table of Contents
- Why I Decided to Audit My Own Production Site
- Finding #1: 825 Bot Accounts Sitting Silently in wp_users
- Finding #2: REST API User Enumeration and XML-RPC Exposure
- Finding #3: Missing HTTP Security Headers and Mixed-Content Traps
- Finding #4: Custom Theme AJAX Handlers and Nonce Discipline
- WordPress Security Hardening Matrix: Before vs After
- Code-Level Fixes I Added Directly to My Theme
- Frequently Asked Questions (FAQ)
1. Why I Decided to Audit My Own Production Site
As developers, we often obsess over feature velocity and page speed while assuming baseline platform defenses are handling themselves. After noticing unusual CPU spikes in my hosting telemetry and several suspicious 404 probes in Nginx access logs, I decided to treat my personal domain like an untrusted client audit.
Most attacks against small and mid-sized sites are not targeted zero-day exploits by elite hackers; they are automated botnets sweeping millions of domains every hour for misconfigurations. Reviewing WordPress.org Hardening Guidelines alongside my actual database state revealed how quickly small defaults compound into serious WordPress security exposure.
Instead of relying on superficial green checkmarks in an admin dashboard, I inspected raw REST responses, database user roles, HTTP response headers, and file permissions over SSH and WP-CLI.
2. Finding #1: 825 Bot Accounts Sitting Silently in wp_users
The first shock came when I queried the user list. Alongside three legitimate editorial accounts, I found 825 subscriber accounts with disposable domains and randomized usernames. Years ago, a legacy theme or plugin setup had flipped users_can_register to enabled—and bots had been quietly registering ever since.
Even though the “Subscriber” role cannot publish posts, keeping hundreds of bot accounts in your database is dangerous. Any future privilege-escalation flaw in a third-party plugin instantly becomes exploitable by an already-authenticated bot user. Furthermore, spam registrations pollute email lists and trigger outbound bounce penalties.
After purging all 825 spam accounts via REST and database cleanup, I added an explicit enforcement filter in my theme setup so users_can_register remains locked to zero unless intentionally overridden for membership functionality. I also tightened file permission and server rules across the host.

3. Finding #2: REST API User Enumeration and XML-RPC Exposure
Next, I ran a simple unauthenticated curl request against /wp-json/wp/v2/users from an incognito terminal. Sure enough, the server politely returned a JSON array listing display names and exact login slugs for every author who had ever published a post.
Giving attackers your exact login usernames eliminates half the work of a credential-stuffing attack. Similarly, leaving xmlrpc.php open lets bots test hundreds of password guesses inside a single multicall HTTP POST request, bypassing naive login-attempt counters.
Disabling unauthenticated access to the users endpoint—while keeping authenticated editorial API calls intact—immediately closed that leak. Pairing that with blocking xmlrpc.php at both the application and reverse-proxy layers cut automated login noise by over 85% within 48 hours.
4. Finding #3: Missing HTTP Security Headers and Mixed-Content Traps
When I inspected live HTTP response headers using curl -I, another glaring omission appeared. While SSL/TLS was active via Cloudflare, the origin application was not emitting essential browser-enforced defense headers.
Without X-Frame-Options: SAMEORIGIN, attackers can embed pages inside invisible iframes for clickjacking. Without X-Content-Type-Options: nosniff, browsers may misinterpret uploaded asset MIME types. And without a clean Permissions-Policy, embedded third-party scripts gain overly broad browser API access.
I injected these lightweight headers directly via PHP send_headers hooks and verified them with external header scanners. Every modern site needs defense-in-depth at the HTTP transport layer, not just inside PHP.

5. Finding #4: Custom Theme AJAX Handlers and Nonce Discipline
During the audit of my custom theme templates, I reviewed every wp_ajax_ and wp_ajax_nopriv_ endpoint—including contact forms, newsletter subscriptions, and view counters. While basic sanitization was present, one endpoint lacked strict nonce validation and relied solely on client-side checks.
Every state-changing endpoint—even public contact or subscribe forms—needs server-side nonce verification (check_ajax_referer()), strict input sanitization, prepared SQL statements via $wpdb->prepare(), and basic honeypot or rate-limiting protections. Reviewing OWASP Top Ten Web Application Risks is a great reminder that broken access control and injection flaws almost always start in custom glue code.
I also noticed several old plugin tables and orphaned options left behind in wp_options. Cleaning unused extensions—something I covered in detail in my solo developer site maintenance guide—shrinks the attack surface dramatically.
6. WordPress Security Hardening Matrix: Before vs After
Measuring concrete state before and after an audit turns vague anxiety into verifiable engineering progress. Here is what changed on my production site:
| Security Vector | Before Audit | After Hardening | Risk Reduction |
|---|---|---|---|
| User Registration | Open (825 bot subscribers) | Purged & locked to admin-only | Eliminates unauthorized accounts |
| REST User Endpoint | Publicly exposed login slugs | Blocked for unauthenticated requests | Stops username harvesting |
| XML-RPC Endpoint | Active & reachable | Disabled via filter & edge rule | Prevents multicall brute force |
| HTTP Response Headers | Basic TLS only | HSTS, Frame, Nosniff, Referrer Policy | Mitigates XSS & clickjacking |
| Admin Credentials | Standard passwords + login | Application Passwords + 2FA + Firewall | Blocks credential stuffing |
7. Code-Level Fixes I Added Directly to My Theme
If you maintain a custom theme or site-specific mu-plugin, adding lightweight hardening guards directly in PHP avoids bloated overhead while enforcing WordPress security defaults permanently:
// 1. Block unauthenticated REST user enumeration
add_filter('rest_endpoints', function ($endpoints) {
if (!is_user_logged_in()) {
unset($endpoints['/wp/v2/users']);
unset($endpoints['/wp/v2/users/(?P<id>[\d]+)']);
}
return $endpoints;
});
// 2. Disable XML-RPC completely
add_filter('xmlrpc_enabled', '__return_false');
// 3. Emit essential HTTP security headers
add_action('send_headers', function () {
header('X-Frame-Options: SAMEORIGIN');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: strict-origin-when-cross-origin');
});
Remember to keep database backups off-site before running user purges or modifying core access rules, and test authenticated REST workflows (like mobile apps or automated publishers) right after tightening endpoints.

6B. Layering Edge WAF Rules With Origin Hardening
Application-level PHP filters are great, yet stopping malicious traffic before PHP even boots saves huge CPU and database load. Putting an edge proxy in front of your origin server lets you block automated scanner patterns cleanly at zero origin cost.
On my production setup, I added simple WAF rules challenging suspicious hits to wp-login.php from non-residential ASNs, blocking direct access to xmlrpc.php, and rate-limiting repeated 404 probes scanning for leaked .env or backup zip files.
Combined with WordPress Application Passwords for automated REST scripts (never sharing your primary admin password in scripts!) and authenticator-based 2FA on all human accounts, brute-force noise dropped to virtually zero.
6C. My Monthly 10-Minute Maintenance Routine
- Review Active Users List: Verify no unexpected administrator or subscriber accounts appeared.
- Check Inactive Themes & Plugins: Delete any deactivated theme or plugin sitting unused on disk—inactive code can still be invoked directly if flawed.
- Verify Backup Restorability: Confirm last night’s encrypted database dump actually uploaded cleanly to off-site storage.
- Inspect PHP & Web Server Error Logs: Look for repeated 500s, deprecated notices, or strange POST requests to unfamiliar endpoints.
8. Frequently Asked Questions (FAQ)
Is installing a firewall plugin enough for WordPress security?
No. A firewall plugin helps filter malicious HTTP requests, yet it cannot compensate for weak admin passwords, abandoned plugins with unpatched vulnerabilities, open user registration, or overly permissive file permissions on your server.
How often should I audit my WordPress site?
Run a quick check of active users, plugin updates, and error logs once a month, and perform a deep architecture and header audit every quarter or after major theme changes.
Does blocking REST API user endpoints break Gutenberg or Rank Math?
Not if you only block unauthenticated requests (!is_user_logged_in()). Logged-in editors, Gutenberg blocks, and authenticated API tools continue working seamlessly.
9. Conclusion: Assume Nothing, Verify Everything
Auditing my own site humbled me quickly. Even experienced engineers accumulate silent configuration drift over years of updates and experiments. Treating WordPress security as an ongoing engineering habit—checking your database, headers, REST routes, and custom code—ensures you discover weak spots long before automated attackers do.