Short answer: To disable XML-RPC in WordPress, first confirm nothing you rely on still uses it, mainly Jetpack, older mobile or desktop publishing apps, and some third-party integrations. If nothing does, block the file at the web server or firewall so requests to /xmlrpc.php never reach PHP: a location = /xmlrpc.php { deny all; } rule in Nginx, a Files block in Apache, or a custom firewall rule at a CDN such as Cloudflare. The popular one-line xmlrpc_enabled filter is weaker than it looks: it disables methods that need a login but leaves pingbacks working. After the change, send a test request with curl and expect a 403, not an XML response.
What XML-RPC is and why attackers like it
XML-RPC is a remote API WordPress has shipped for years, handled by the xmlrpc.php file in your site’s root. Before the REST API existed, it let apps publish posts, manage comments and send pingbacks between blogs. It’s still enabled by default for compatibility. Attackers value it for three reasons:

- Amplified brute force. The
system.multicallmethod lets one HTTP request contain many login attempts, so password guessing can run far faster than through wp-login.php and may slip past limits that count requests. - Pingback abuse. The
pingback.pingmethod makes your server fetch a URL supplied by the requester. Attackers have used large numbers of WordPress sites this way to flood a target, and the same behavior can be used to probe other hosts. - Noise and load. Even failed attacks consume PHP workers and database queries, which slows small sites.
XML-RPC isn’t a vulnerability by itself. Sites with strong unique passwords and two-factor authentication resist the brute-force angle. But if nothing needs it, turning it off removes an attack surface for free.
Check what still depends on XML-RPC
| Feature or tool | Uses XML-RPC? | What to do |
|---|---|---|
| Jetpack and WordPress.com connection | Yes | Keep XML-RPC reachable for Jetpack, or allow its servers in your firewall rule |
| Older WordPress mobile app versions and desktop blogging clients | Often | Update the app or switch to the block editor in a browser |
| Incoming pingbacks and trackbacks | Yes | Most sites don’t need them; disable in Settings > Discussion |
| Block editor, REST API and application passwords for REST | No | Unaffected by blocking xmlrpc.php |
| Some automation and remote publishing services | Sometimes | Check the service’s documentation before blocking |
Look at your access logs before deciding. Requests to xmlrpc.php from your own IP address or from a service you recognize show real use; thousands of POST requests from scattered IPs show attacks. A quick way to count on a typical Linux server:
grep "POST /xmlrpc.php" /var/log/nginx/access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head
Option 1: the WordPress filter
Many tutorials suggest adding this to a small plugin or your theme:
add_filter( 'xmlrpc_enabled', '__return_false' );
The WordPress code reference describes this filter as controlling XML-RPC methods that require authentication. That blocks logins through XML-RPC, which stops multicall brute force, but pingbacks and other unauthenticated methods still respond, and every request still loads WordPress and PHP. To also drop pingback methods and the X-Pingback header, a fuller snippet looks like this:
add_filter( 'xmlrpc_enabled', '__return_false' );
add_filter( 'xmlrpc_methods', function ( $methods ) {
unset( $methods['pingback.ping'], $methods['pingback.extensions.getPingbacks'] );
return $methods;
} );
add_filter( 'wp_headers', function ( $headers ) {
unset( $headers['X-Pingback'] );
return $headers;
} );
Put it in a must-use plugin so a theme change doesn’t silently remove it. This option suits sites on shared hosting where you can’t change server configuration.
Option 2: block at the web server
Blocking xmlrpc.php before PHP runs is more effective and saves resources. On Nginx, add this inside your site’s server block, then test and reload:
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
On Apache 2.4, add to the site’s virtual host or root .htaccess:

<Files xmlrpc.php>
Require all denied
</Files>
If you need Jetpack, replace the blanket deny with rules that allow only Jetpack’s published IP ranges. Our guide to hardening WordPress on Apache 2.4 covers the surrounding .htaccess rules in more depth.
Option 3: block at the firewall or CDN
If your site sits behind Cloudflare or another proxy, a firewall rule stops the traffic before it reaches your server at all. In Cloudflare, create a custom rule matching URI Path equals /xmlrpc.php with the action Block. Add an exception for Jetpack if you use it. Security plugins with firewalls can also block XML-RPC, but they run inside WordPress, so they save less load than a server or CDN rule.
Test that it’s really off
Don’t trust the change until you’ve tested it from outside. A request listing the available methods is the clearest check:
curl -s -o /dev/null -w "%{http_code}\n" -X POST -H "Content-Type: text/xml" -d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' https://example.com/xmlrpc.php
A server or firewall block should return 403. If you used only the WordPress filter, you’ll still get 200 with a list of methods, minus the ones you removed. Run the test again after any server migration, caching change or new security plugin, since those can undo the rule. Then watch your logs for a day; attack traffic to xmlrpc.php should now show 403 responses and stop consuming PHP.
Do the rest of the login hardening too
Blocking XML-RPC closes one route, but wp-login.php remains. Strong unique passwords, rate limiting and two-factor authentication for administrators matter more. See stopping WordPress brute force attacks for server-level rate limits, and consider whether to limit your REST API exposure as well with our guide to WordPress REST API security.
Common mistakes when turning XML-RPC off
A few errors come up again and again. The first is relying on a caching or security plugin’s checkbox without testing: some plugins only hide the X-Pingback header or block XML-RPC logins, which looks like success in the settings screen but leaves the endpoint answering requests. The second is adding an Nginx rule to the wrong server block, such as the HTTP block that only redirects to HTTPS, so the HTTPS site never sees it. The third is blocking xmlrpc.php on the origin server while the site’s CDN caches or forwards requests in a way that bypasses the rule; test the public hostname, not just the server’s IP. Finally, people forget staging and secondary domains. If the same WordPress install answers on more than one hostname, each one needs testing, because attackers scan every name they can find in certificates and DNS.
If something breaks after the change, such as Jetpack reporting a connection error, check the Jetpack dashboard’s connection test first and add an allow rule for its servers rather than reopening the file to everyone.
Frequently asked questions
Will disabling XML-RPC break the block editor?
No. The block editor uses the REST API, not XML-RPC.
Does disabling XML-RPC stop all brute-force attacks?
No. Attackers can still target wp-login.php. Combine the block with rate limiting and two-factor authentication.
Should I delete xmlrpc.php?
No. WordPress restores it on the next core update, and a deleted core file causes checksum warnings. Block access instead.
Is the X-Pingback header a security risk?
It simply advertises the XML-RPC endpoint. Removing it is tidy but blocking the endpoint matters more.



