Introduction
WordPress powers over 40 percent of the web, making standard endpoints attractive targets for automated botnets and malicious scanners.
The legacy XML-RPC interface (xmlrpc.php) remains enabled by default, despite being a primary vector for amplified brute-force attacks and DDoS reflection.
Similarly, default REST API endpoints (wp-json/wp/v2/users) expose author usernames to unauthenticated visitors, simplifying credential-stuffing exploits.
Hardening these two entry points eliminates the vast majority of automated WordPress intrusion attempts without affecting normal visitor operations.

Disabling XML-RPC at the Web Server Level
While WordPress filters can disable XML-RPC methods in PHP, requests still spin up the entire PHP and database engine before being rejected.
Block xmlrpc.php directly at the web server level (Nginx or Apache) to drop malicious requests instantly with zero PHP resource consumption.
In Nginx, add a location = /xmlrpc.php block returning 403 Forbidden.
On Apache or LiteSpeed, use mod_rewrite or FilesMatch directives to block all access to xmlrpc.php.
This shields server memory during aggressive brute-force campaigns.
Securing User Enumeration in the REST API
By default, any visitor can request /wp-json/wp/v2/users and receive a list of usernames, IDs, and author slugs.
Use the rest_authentication_errors filter hook to require authenticated sessions for reading user lists.
This ensures legitimate admin tools and mobile apps can still query users after authenticating, while blocking anonymous crawlers.
Pair this with disabling author archive scanning (?author=1 redirects) to close secondary username discovery vectors.
Preserving Necessary Third-Party REST Integrations
Never disable the WordPress REST API entirely, as doing so breaks the Gutenberg block editor, WooCommerce checkout blocks, and modern contact forms.
Instead, apply targeted endpoint restrictions based on route prefixes.
Keep public endpoints like posts, categories, and custom public post types accessible for search engines and frontend feeds.
Targeted endpoint security gives you maximum protection without compromising site functionality.
Frequently Asked Questions
<strong>Q: Does disabling XML-RPC break the Jetpack plugin?</strong><br>Yes, legacy Jetpack features rely on XML-RPC communication. If Jetpack is strictly required, whitelist Automattic IP ranges in your server configuration rather than opening XML-RPC to the global internet.
<strong>Q: Does blocking user enumeration guarantee immunity from brute force?</strong><br>No, but it forces attackers to guess both the username and password simultaneously rather than having half of the login credential handed to them publicly.