What XML-RPC is
xmlrpc.php lets other programs talk to your WordPress site remotely: publish posts from a desktop app, receive pingbacks from other blogs, or connect services like Jetpack. It dates from long before WordPress had its modern REST API.
Why attackers like it
- Faster password guessing. XML-RPC can accept many login attempts in a single request, which can make brute-force attacks more efficient and harder for simple login limiters to notice.
- Pingback abuse. The pingback feature can be used to make your site send requests to other sites, for example as part of an attack on someone else.
- Noise. Constant requests to
xmlrpc.phpuse server resources, even when they fail.
Do you need it?
You probably don’t, unless you use:
- Jetpack, which uses XML-RPC to connect to WordPress.com;
- an older mobile or desktop app to publish posts;
- a service that publishes to your site remotely using XML-RPC.
How to disable it
Block the file (Apache)
The most complete option. Add to your root .htaccess:
<Files "xmlrpc.php">
Require all denied
</Files>
On Nginx, ask your host to deny access to /xmlrpc.php.
With a security plugin
Wordfence, Solid Security, AIOS and others have a setting to disable XML-RPC or its authentication methods.
With Cloudflare
If your site is behind Cloudflare, a single firewall rule can block /xmlrpc.php before the request reaches your server. See Cloudflare firewall rules for WordPress.
A note on the xmlrpc_enabled filter
You’ll often see add_filter( 'xmlrpc_enabled', '__return_false' ); recommended. It turns off the XML-RPC methods that require logging in, but not everything (pingbacks, for example). Blocking the file is more thorough.
From my cleanup work: when I read access logs on a hacked site, xmlrpc.php is nearly always among the most requested files, thousands of times a day, almost all of it bots. It’s rarely the way in on its own. But blocking it removes a lot of noise, makes the real attack easier to spot, and closes one door for good.