Short answer: To disable XML-RPC in WordPress, first confirm nothing needs it, such as Jetpack. Then block /xmlrpc.php before PHP runs with a Cloudflare WAF rule, an nginx location block or an Apache .htaccess rule returning 403, and add a small mu-plugin that removes all XML-RPC methods. Verify with a curl request.
Key takeaways
- xmlrpc.php is an old remote API that most modern sites no longer need.
- Attackers use system.multicall to test many passwords per request and pingbacks for DDoS amplification.
- Blocking at Cloudflare or the web server is best because PHP never runs for blocked requests.
- The xmlrpc_enabled filter alone leaves pingbacks open; remove all methods with xmlrpc_methods.
- The block editor and REST API are unaffected; Jetpack needs an exception.

Open the access log of almost any WordPress site and you will find a steady stream of POST requests to /xmlrpc.php from addresses all over the world. Most site owners never use XML-RPC, yet every one of those requests starts PHP, loads WordPress and may test a password. Disabling it is one of the simplest hardening steps with an immediate effect on server load.
On the sites I manage, I block xmlrpc.php at Cloudflare and at nginx, so attacks are stopped before they reach PHP-FPM. This guide shows how to check whether you need XML-RPC, every practical way to disable it, and how to verify the result.
What is xmlrpc.php in WordPress?
xmlrpc.php is the endpoint for WordPress’s XML-RPC API, a remote procedure call interface from the early days of blogging. It lets external applications publish and edit posts, upload media, manage comments and send pingbacks by posting XML to one URL. WordPress still ships it, and it is enabled by default.
XML-RPC: a protocol that encodes remote procedure calls in XML and sends them over HTTP. WordPress exposes methods such as wp.getPosts, wp.newPost and pingback.ping.
REST API: the modern WordPress API at /wp-json/, used by the block editor, mobile apps and integrations. It is separate from XML-RPC.
Why do attackers target XML-RPC?
XML-RPC is attractive to attackers for two reasons. The system.multicall method lets one HTTP request contain hundreds of login attempts, which bypasses many per-request login limiters. Pingbacks can make your site send requests to a victim, turning WordPress sites into DDoS helpers, and can reveal your origin IP behind a CDN.
- Brute force amplification: many username and password guesses per request.
- Resource exhaustion: each request boots WordPress and PHP, so floods slow the site.
- Pingback abuse: reflected requests to third parties and origin IP disclosure.
- Information leakage: method lists and error messages reveal what is enabled.
How does a system.multicall brute-force attack work?
system.multicall is a standard XML-RPC method that bundles many method calls into one request. Attackers place hundreds of wp.getUsersBlogs calls, each with a different password, inside a single POST. WordPress checks every password, and the attacker learns which one worked from the response. Login limiters that count requests rather than attempts never notice.
WordPress core has added protections over the years, for example stopping further authentication attempts within a multicall after a failure in recent versions, but older sites, outdated configurations and the sheer volume of requests still make XML-RPC a common entry point. Even when attacks fail, each request costs a PHP worker and database queries.
XML-RPC vs the WordPress REST API
The REST API, introduced in WordPress 4.7, is the modern replacement for most XML-RPC uses. It uses JSON over standard HTTP methods, supports application passwords and OAuth-style plugins, and powers the block editor. New integrations should use REST; XML-RPC remains mainly for backward compatibility.
| Aspect | XML-RPC | REST API |
|---|---|---|
| Endpoint | /xmlrpc.php (single URL) | /wp-json/ (many routes) |
| Format | XML | JSON |
| Authentication | Username and password in each call | Cookies with nonces, application passwords |
| Used by | Jetpack, legacy apps, pingbacks | Block editor, apps, integrations |
| Recommended | Only when required | Yes |
Do you need XML-RPC? Check before disabling
Most sites do not need XML-RPC. Keep it only if you use Jetpack, an old desktop or mobile publishing app that connects through XML-RPC, or a remote publishing or management tool that documents it as a requirement. The block editor, the REST API and application passwords do not need it.
| You use | Needs XML-RPC? | What to do |
|---|---|---|
| Block editor (Gutenberg) | No | Disable freely |
| REST API integrations, n8n, Zapier | No | Disable freely |
| Jetpack | Yes | Allow Automattic IPs only |
| Legacy publishing apps | Often | Switch to REST-based tools, or allow-list |
| Pingbacks and trackbacks | Yes | Most sites are better without them |
Step 1: test whether XML-RPC is enabled
Send a system.listMethods request with curl. If you get an XML list of methods, XML-RPC is enabled. A 403 or 405 response means something already blocks it. Also check your logs to see how often it is hit and from where.
# Is XML-RPC enabled? A 200 with a list of methods means yes
curl -s -X POST https://example.com/xmlrpc.php
-H "Content-Type: text/xml"
-d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' | head -n 20
# Just the status code
curl -s -o /dev/null -w "%{http_code}n" -X POST https://example.com/xmlrpc.php
# How often is xmlrpc.php hit, and by whom? (nginx)
sudo grep -c "POST /xmlrpc.php" /var/log/nginx/access.log
sudo awk '$7=="/xmlrpc.php"{print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
Step 2: block xmlrpc.php in Cloudflare
If your site is proxied through Cloudflare, a WAF custom rule blocks requests at the edge, before they reach your server at all. This is the most efficient option and works on the free plan. Create a rule that blocks the URI path /xmlrpc.php.
Cloudflare dashboard > Security > WAF > Custom rules > Create rule
Field: URI Path Operator: equals Value: /xmlrpc.php
Action: Block
Expression editor:
(http.request.uri.path eq "/xmlrpc.php")
I combine this with other edge rules such as a managed challenge on wp-login.php; see Cloudflare WAF rules for WordPress for the full set. An edge rule only protects traffic through Cloudflare, so also block at the server in case someone connects to your origin directly.
From my own work: My own Cloudflare rule blocks xmlrpc.php together with probe paths such as /.env, /.git and wp-config, plus the user enumeration endpoints. Once it was live, the PHP-FPM log stopped showing those bursts of workers spinning up for requests no human ever made.
Step 3: block xmlrpc.php in nginx
In nginx, an exact-match location for /xmlrpc.php that denies all requests returns 403 without passing anything to PHP-FPM. Put it in the server block of your WordPress site, before the generic PHP location, then test and reload.
# In the server block of your WordPress site
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
return 403;
}
sudo nginx -t && sudo systemctl reload nginx
The exact match location = has the highest priority in nginx, so it wins over regular-expression locations for .php files. Turning off logging for it keeps your logs readable during floods.
Step 3 (Apache): block xmlrpc.php in .htaccess
On Apache 2.4 or LiteSpeed shared hosting, add a Files block to the .htaccess file in your WordPress root. It denies all access to xmlrpc.php before WordPress loads.
# .htaccess (Apache 2.4+)
<Files xmlrpc.php>
Require all denied
</Files>
Step 4: disable XML-RPC inside WordPress with a mu-plugin
A WordPress-level setting is a useful second layer if server rules change or the site moves. The xmlrpc_enabled filter turns off methods that require authentication, and the xmlrpc_methods filter removes the rest, including pingbacks. A must-use plugin cannot be deactivated from the dashboard by accident.
<?php
/**
* Plugin Name: Disable XML-RPC
* Description: Turns off XML-RPC, pingbacks and the X-Pingback header.
*/
// Disable XML-RPC methods that require authentication
add_filter( 'xmlrpc_enabled', '__return_false' );
// Remove all remaining methods, including pingback.ping
add_filter( 'xmlrpc_methods', function () {
return array();
} );
// Stop advertising the endpoint
add_filter( 'wp_headers', function ( $headers ) {
unset( $headers['X-Pingback'] );
return $headers;
} );
remove_action( 'wp_head', 'rsd_link' );
Save it as wp-content/mu-plugins/disable-xmlrpc.php. Must-use plugins load automatically; my guide to WordPress mu-plugins explains how they work. Security plugins such as Wordfence or Solid Security also offer an XML-RPC toggle if you prefer a settings page.
How to keep Jetpack working
Jetpack connects to your site from WordPress.com servers through XML-RPC. If you use it, allow Automattic’s IP ranges to reach xmlrpc.php and deny everyone else, and keep the list in sync with Jetpack’s documentation. Do not install the mu-plugin above in that case, because it removes all methods.
# Allow Jetpack (Automattic) while blocking everyone else - keep the list current
location = /xmlrpc.php {
allow 192.0.64.0/18; # Automattic range, check Jetpack docs for the full list
deny all;
include fastcgi_params; # then pass allowed requests to PHP-FPM as usual
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
Should you keep pingbacks and trackbacks?
For almost every site, no. Pingbacks were designed to notify blogs when another blog linked to them, but today they mostly bring spam comments and can be abused to send requests to third parties. Turn them off under Settings, Discussion by unchecking “Allow link notifications from other blogs”, and close pings on existing posts with WP-CLI if needed.
Disabling pingbacks in the settings does not remove the pingback.ping XML-RPC method, which is why the mu-plugin above removes all methods. Doing both keeps the dashboard and the API consistent, and means no future plugin can quietly re-enable pingbacks through XML-RPC without you noticing in a code review.
Step 5: verify the result
Repeat the curl test from step 1; it should now return 403. Then check that normal features still work: logging in, editing posts in the block editor, the REST API at /wp-json/, scheduled posts, contact forms and any integrations.
curl -s -o /dev/null -w "%{{http_code}}" -X POST https://example.com/xmlrpc.phpreturns 403.curl -s https://example.com/wp-json/ | head -c 200still returns JSON.- No X-Pingback header in
curl -sI https://example.com/.
How do you measure the effect of blocking XML-RPC?
Compare server metrics before and after the change. On a busy target you should see fewer PHP-FPM workers in use, lower CPU during attack bursts and fewer database connections. In Cloudflare, the Security Events view shows how many requests the rule blocked, and your nginx logs show 403 responses instead of 200s from PHP.
- Cloudflare: Security, Events, filtered by your rule name.
- nginx: count 403 responses for /xmlrpc.php per day.
- PHP-FPM: watch for fewer “max_children reached” warnings in the FPM log.
- Uptime: fewer slowdowns during the attack bursts that used to hit the site.
What else should you harden alongside XML-RPC?
Disabling XML-RPC closes one door. Pair it with login protection, user enumeration blocking, strong passwords and two-factor authentication, server-level rate limits, security headers, timely updates and tested backups.
- Rate-limit wp-login.php with nginx rate limiting.
- Ban repeat offenders with fail2ban.
- Add a human check to forms with Cloudflare Turnstile.
- Block /wp-json/wp/v2/users and ?author= enumeration if you do not need them.
- Restore real visitor IPs behind Cloudflare so bans work: nginx real IP behind Cloudflare.
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Still returns 200 | Rule in wrong server block or cache | Check the active vhost; purge CDN cache |
| Jetpack disconnected | XML-RPC blocked for Automattic | Allow Jetpack IP ranges |
| Mobile app cannot connect | Legacy XML-RPC connection | Use application passwords and REST, or allow-list |
| nginx -t fails | Typo or duplicate location | Read the error line; remove duplicates |
Checklist
- Confirmed nothing needs XML-RPC (or Jetpack exception planned).
- Cloudflare WAF rule blocks /xmlrpc.php.
- nginx or Apache returns 403 for xmlrpc.php.
- mu-plugin removes all methods and the X-Pingback header.
- curl test returns 403; REST API still works.
- Logs show blocked requests no longer reaching PHP.
Want this done on your own server or site?
I am Saizul Amin, a web developer and technical SEO consultant. I set up and harden VPS servers, migrate WordPress sites, fix indexing problems and build automations. See my portfolio or get in touch.
FAQ
What is xmlrpc.php in WordPress?
xmlrpc.php is WordPress’s XML-RPC endpoint, an older remote API that lets external apps publish posts, manage comments and send pingbacks. Most of its uses have been replaced by the REST API, but the file is still present and enabled by default on WordPress sites.
Should I disable XML-RPC in WordPress?
Disable it if nothing on your site needs it. It is a common target for brute-force login attempts, because system.multicall can test many passwords in one request, and pingbacks can be abused in DDoS attacks. Keep it only if you rely on Jetpack or a tool that requires XML-RPC.
What is the best way to disable XML-RPC?
Block it as early as possible: a Cloudflare WAF rule or an nginx or Apache rule returns 403 before PHP runs, which saves server resources. Add a small mu-plugin as a second layer so WordPress itself has XML-RPC turned off even if the server rule is removed.
Does disabling XML-RPC break Jetpack?
Yes, Jetpack uses XML-RPC to communicate with WordPress.com. If you use Jetpack, allow Automattic’s IP ranges to reach xmlrpc.php and block everyone else, or rely on a security plugin’s Jetpack-aware setting.
Does disabling XML-RPC affect the REST API or Gutenberg?
No. The block editor, the WordPress REST API, application passwords and modern apps use the REST API at /wp-json/, which is separate from xmlrpc.php. Disabling XML-RPC does not affect them.
Is the xmlrpc_enabled filter enough?
Not on its own. The xmlrpc_enabled filter disables methods that need authentication, but pingback methods remain available. Use the xmlrpc_methods filter to remove all methods, or block the file at the web server or Cloudflare.
Sources
- WordPress Developer Resources: XML-RPC
- WordPress Developer Resources: xmlrpc_enabled filter
- WordPress Developer Resources: xmlrpc_methods filter
- nginx: ngx_http_access_module
- Apache: Access control
- Cloudflare: WAF custom rules
- Jetpack: Known issues, including XML-RPC

Saizul Amin is a web developer, AI automation engineer and technical SEO consultant from Dhaka, Bangladesh (B.Sc. in CSE, BUBT). Since 2017 he has worked in digital marketing, WordPress, IT infrastructure and server administration, including the bilingual SHR Bangladesh website for DGHS, WordPress sites for UK and US clients, and the ShobFree tools platform. He runs this blog on his own Ubuntu VPS with nginx, Redis and CloudPanel, and tests the guides here on it. Portfolio: saizul.com

