How to Disable XML-RPC in WordPress (and When You Should)

How to Disable XML-RPC in WordPress (and When You Should)

Table of Contents

If you’ve ever looked at your server logs or your security plugin’s activity report, you’ve probably seen a file called xmlrpc.php getting hit again and again. You didn’t create it, you’ve never used it, and yet bots seem very interested in it. So what is it, and should you just turn it off?

For many sites, the answer is yes. But XML-RPC still powers a few useful features, so blocking it without thinking can break something you rely on. In this guide, we explain what XML-RPC does, how attackers abuse it, how to disable XML-RPC safely with three different methods, and when you should leave it switched on.

What Is XML-RPC in WordPress?

XML-RPC is a way for other programs to talk to your WordPress site over the internet. It uses the file xmlrpc.php in your site’s root folder. Through it, an outside app can log in, publish posts, upload media and manage comments without opening the dashboard.

It was added long before WordPress had its modern REST API, and it has been enabled by default since WordPress 3.5. Historically, it has been used for:

  • Remote publishing: desktop blogging tools and older versions of mobile apps
  • Jetpack: which uses xmlrpc.php to communicate with WordPress.com
  • Pingbacks and trackbacks: the notifications WordPress sends when one blog links to another
  • Some third-party integrations and automation tools

Today, most of this work is done through the REST API and application passwords instead. That’s why many sites have no real need for XML-RPC anymore, but still leave it open.

Why Attackers Abuse xmlrpc.php

XML-RPC accepts a username and password with almost every request. That makes it a favorite target for bots.

Brute force attacks

The system.multicall method lets a client send many commands in a single request. Attackers use it to try many passwords at once, which means one request in your log can hide hundreds of login attempts. Some login-limiting tools only watch wp-login.php and miss this completely.

Pingback abuse

The pingback.ping method makes your site fetch a URL to verify a link. Attackers can send many fake pingbacks to make lots of WordPress sites request the same target at once, using your site in a denial-of-service attack against someone else.

Server load

Every XML-RPC request loads WordPress and runs PHP. A steady stream of bot requests can slow your site or push a shared hosting account over its resource limits.

How attackers abuse xmlrpc.php with multicall brute force and pingback attacks
The main ways bots abuse an open xmlrpc.php file.

Signs XML-RPC Is Being Abused on Your Site

  • Your access logs show many POST /xmlrpc.php requests from different IP addresses
  • Your host reports high CPU usage, or your site shows 503 or 508 errors
  • Your security plugin logs failed logins even though your login page is protected
  • Your host or another site owner reports that your server is sending a lot of pingback requests

With SSH access, you can count XML-RPC requests per IP address with this command (use the log path your host provides):

grep "POST /xmlrpc.php" access.log | awk '{print $1}' | sort | uniq -c | sort -nr | head -20

A lot of traffic to xmlrpc.php doesn’t mean your site is hacked. But if an attacker did manage to guess a password, check our list of hacked website signs right away.

When Should You Disable XML-RPC?

Disable it if:

  • You manage your site only through the normal dashboard
  • You don’t use Jetpack
  • You don’t publish from a desktop app or third-party tool that uses XML-RPC
  • You don’t need pingbacks

Keep it, but restrict it, if:

  • You use Jetpack or a service that still depends on XML-RPC
  • You publish from an older app or tool that hasn’t moved to the REST API

If you’re not sure, disable XML-RPC temporarily and test the tools you use for a few days. If something stops working, you can always turn it back on and restrict it instead.

How to Disable XML-RPC in WordPress: 3 Methods

Take a backup first, then choose the method that fits your setup. Blocking at the server level is the most complete option, because the request never reaches WordPress.

Method 1: Use a security plugin

A plugin is the quickest way to disable XML-RPC without touching any code. Many security plugins include an option to disable or restrict XML-RPC. Look for it in the plugin’s firewall, hardening or login security settings. There are also small single-purpose plugins for this. A plugin is the easiest choice if you’re not comfortable editing files, but WordPress still loads for each request, so it does less to reduce server load.

Method 2: Block xmlrpc.php on the server

This is the method we recommend for most sites that don’t need XML-RPC. On Apache or LiteSpeed, add this to the .htaccess file in your WordPress root, outside the # BEGIN WordPress block:

<Files xmlrpc.php>

Require all denied

</Files>

On Nginx, add location = /xmlrpc.php { deny all; } to your server block and reload Nginx, or ask your host to do it. Some hosts also offer a one-click XML-RPC toggle in their control panel.

Don’t delete xmlrpc.php itself. WordPress core updates will put it back, and checksum tools will flag the missing file.

Server rule to disable XML-RPC in WordPress and a curl test returning 403 Forbidden
Blocking xmlrpc.php at the server stops requests before WordPress loads.

Method 3: Use a WordPress filter

If you prefer code, you can add this line to a small custom plugin or to your child theme’s functions.php:

add_filter( 'xmlrpc_enabled', '__return_false' );

Be aware of an important limit. According to the official xmlrpc_enabled filter documentation, this filter only turns off methods that require authentication. Unauthenticated methods, such as pingbacks, still work. To remove pingbacks too, also use the xmlrpc_methods filter to remove pingback.ping from the list of methods. If you want XML-RPC fully off, the server-level block in Method 2 is simpler and more reliable.

If you need XML-RPC: restrict it

If you rely on Jetpack or another service, don’t block the file for everyone. Instead, rate-limit requests to xmlrpc.php in your firewall or CDN, allow only the services you trust if your firewall supports it, and use strong passwords with two-factor authentication on every account. The WordPress brute force attacks handbook recommends the same approach: disable XML-RPC when you don’t need it, and restrict it when you do.

How to Check That XML-RPC Is Disabled

After you disable XML-RPC, WordPress should no longer answer requests to it. Test it in two ways:

  1. In the browser: visit https://example.com/xmlrpc.php, using your own domain. If XML-RPC is open, you’ll see the message “XML-RPC server accepts POST requests only.” If you blocked it on the server, you’ll see a 403 Forbidden page instead.
  2. From the command line: run curl -I https://example.com/xmlrpc.php. A blocked file returns 403. To test the filter method, send a real request with curl -d "<methodCall><methodName>system.listMethods</methodName></methodCall>" https://example.com/xmlrpc.php and check what comes back.

Clear any page or CDN cache before testing, and test the apps or plugins you use to make sure nothing broke.

Other Ways to Protect Your WordPress Login

Disabling XML-RPC closes one door, but bots will still try wp-login.php. Combine it with these steps:

  • Use long, unique passwords stored in a password manager
  • Turn on two-factor authentication for every administrator
  • Limit login attempts and use a firewall
  • Remove the admin username and keep administrator accounts to a minimum
  • Keep WordPress, plugins and themes updated
  • Add security headers; see our guide on fixing missing security headers in WordPress

Our checklist on how to prevent a WordPress hack covers each layer in more detail.

Frequently Asked Questions

Will disabling XML-RPC break my site?

For most sites, no. Your pages, dashboard, forms and WooCommerce checkout don’t use XML-RPC. What can break are Jetpack features, some remote publishing tools and pingbacks.

Does the REST API replace XML-RPC?

For most modern uses, yes. Newer apps and integrations use the REST API, often with application passwords. Disabling XML-RPC doesn’t affect the REST API.

Is XML-RPC a security vulnerability?

Not by itself. It’s a normal WordPress feature. The risk is that it gives bots another way to guess passwords and abuse pingbacks, so if you don’t use it, there’s no reason to leave it open.

Is it safe to disable XML-RPC on a WooCommerce store?

Usually, yes. WooCommerce products, cart, checkout and payment gateways use normal page requests, AJAX and the REST API, not XML-RPC. Some older inventory or mobile management tools may still rely on it, so test your connected apps and order notifications after blocking the file.

Can I just delete xmlrpc.php?

It’s better not to. The file returns with every core update, and deleting core files makes integrity checks harder. Block it with a server rule instead.

Will disabling XML-RPC remove malware from my site?

No. It only blocks one way in. If your site was already hacked, you need a full cleanup. Our WordPress malware removal guide explains the process, and our guide on why a WordPress site keeps getting hacked helps if the problem keeps returning.

Need Help Securing Your WordPress Site?

If bots got through before you disabled XML-RPC, your site may already contain unknown admin users, backdoors or malware. We clean the site, remove everything the attacker left behind and harden your login, XML-RPC and server settings so it stays secure. Get started with our hacked website repair service, or choose emergency malware removal if your site is under attack right now.

Share This Post

Facebook
LinkedIn
Need Help? We're Here!

If your website is hacked or showing malware warnings, don’t panic. Contact us now and we will clean it for you.