Blog
SavedSearch
Visit Hostlelo

How to turn off XML-RPC on WordPress, and prove it is really off

Turn off WordPress XML-RPC with a must-use plugin plus an Apache or Nginx rule, then prove it with curl. Covers Jetpack, testing and Application Passwords.

The short answer

To turn off XML-RPC on WordPress, add a must-use plugin that sets the xmlrpc_enabled filter to false, then block xmlrpc.php at the web server with an Apache or Nginx rule. The filter only switches off XML-RPC methods that need a login, so the server block is what stops the file from answering. Run curl against xmlrpc.php before and after to prove the change, and skip this on Jetpack-connected sites because Jetpack uses XML-RPC.

Reading options

On this page

To turn off XML-RPC on WordPress properly, you use two layers: a tiny must-use plugin that sets the xmlrpc_enabled filter to false, and a server rule in Apache or Nginx that refuses every request to xmlrpc.php. The filter alone only switches off the XML-RPC methods that need a login, so the file still answers. Doing only one of them leaves a door that is pulled shut but not locked.

In this guide you will record what your xmlrpc.php says today, add both layers, and then prove with two curl commands that it is really off.

What XML-RPC actually is

Think of your WordPress site as a shop. The front door is the website your visitors see, and the back office is wp-admin, where you log in and work. XML-RPC is a small service hatch on the side wall, built so that outside programs could hand things to the shop without coming through the front door.

Technically, it is a way for another program to talk to WordPress by sending a request written in XML to one file, xmlrpc.php, and getting an answer back. The WordPress developer documentation says the XML-RPC API supersedes the older Blogger, MovableType and metaWeblog APIs. Those were the ways people published to blogs from outside the browser in the early days.

According to the WordPress Codex, XML-RPC has been turned on by default since WordPress 3.5. The same page says many popular weblog clients publish through XML-RPC. So unless someone has closed it, the hatch is open.

If nothing you use needs the hatch, you can close it. If something you rely on still uses it, closing it will break that thing. That is why the checklist below matters more than the code.

Before you start

Run through this list before you touch a single file. It is short and can save you a long evening.

  • Take a backup first. Copy your files and export your database, or confirm your host has a recent restore point you know how to use.
  • Check for Jetpack. At the time of writing (22 November 2026), Jetpack's own support page says it uses XML-RPC to connect to WordPress.com, and blocking it breaks the Jetpack connection. If your site is connected to Jetpack, do not block xmlrpc.php.
  • Ask what else might use it. Think about any desktop or phone app, remote management service or older integration that posts to your site. If you are not sure, ask whoever set the site up.
  • Make sure you have real access. You need admin access to WordPress, plus file access through SFTP, SSH or your hosting file manager, so you can add and remove files without wp-admin.
  • Know your web server. Find out whether your site runs on Apache or Nginx. Your host can tell you, and if this is new to you, our guide on what web hosting is explains where these pieces sit.
  • Use a test copy if you have one. A staging site lets you try every step and see what breaks before your visitors do.

How to turn off XML-RPC in four steps

Here is the plan in short. You record how xmlrpc.php answers today, add the must-use plugin, block the file at the web server, and then test again.

Step 1: Check the current answer of xmlrpc.php

You want a "before" picture so you have something to compare against later. Open a terminal and swap example.com for your own domain in each command.

This first command asks only for the response headers, so you can see the status line the server sends back.

curl -I https://example.com/xmlrpc.php

Write down the first line of the output, the one that starts with HTTP. You do not need to decode it yet. You only need to know what it says today.

This second command sends a real XML-RPC request that asks the server to list the methods it offers.

curl -s -d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' https://example.com/xmlrpc.php

Save the reply in a text file. Record exactly what your server returns, whatever it is. Keep both results, because you will run the same two commands at the end.

Step 2: Add the must-use plugin

A must-use plugin is one that WordPress always loads. The WordPress documentation says these live in wp-content/mu-plugins, load in alphabetical order before normal plugins, and cannot be disabled from wp-admin. That last point is the reason to use one here. Nobody can switch the setting off by accident while tidying up the Plugins page.

Two more details from that page trip people up. WordPress only looks for PHP files placed directly inside wp-content/mu-plugins, so a file inside a subfolder is ignored. Activation hooks do not run for must-use plugins, so the file has to do its job the moment it loads, which this one does.

Here is what to do.

  1. Open your site's files and go into wp-content.
  2. If there is no mu-plugins folder, create one with exactly that name.
  3. Inside it, create a file called disable-xmlrpc.php.
  4. Paste in the code below and save the file.

This is the whole plugin, and all it does is set the xmlrpc_enabled filter to false.

<?php
/**
 * Plugin Name: Disable XML-RPC
 */
add_filter( 'xmlrpc_enabled', '__return_false' );

The __return_false part is a small helper function that ships with WordPress and simply returns false. Next time you open the Plugins screen in wp-admin, look for a Must-Use list that shows "Disable XML-RPC".

Now the caveat that most guides skip. The developer reference for xmlrpc_enabled says it "Filters whether XML-RPC methods requiring authentication are enabled." It was introduced in version 3.5.0, and its $is_enabled parameter defaults to true. The XML-RPC server class sets its own on or off state from this filter.

In plain words, the filter switches off the methods that need a username and password. It does not remove xmlrpc.php, and that file will still answer requests. So the plugin does a useful job, because nobody can log in through XML-RPC anymore. The hatch is still there, though, and it still talks. That is why you add the second layer.

Step 3: Block the file at the server

This layer stops the request before WordPress even starts. The web server sees a request for xmlrpc.php and refuses it. Pick the variant that matches your server. If you have no idea which one you run, ask your host before editing anything.

Apache 2.4 with `.htaccess`

On Apache, you add a short block to the .htaccess file in the folder where WordPress is installed, the same folder that holds wp-config.php. The Apache 2.4 documentation lists .htaccess as a valid place for the <Files> directive, which applies the rules inside it to matching file names. The access control documentation says Require all denied denies access unconditionally.

Put this block near the top of .htaccess, outside the # BEGIN WordPress and # END WordPress markers so WordPress does not overwrite it when it rewrites that section.

<Files "xmlrpc.php">
    Require all denied
</Files>

Save the file and load your homepage straight away. If the site still loads, good. If you see a server error, remove the block, save again, and jump to the troubleshooting section. If you have edited .htaccess before for other jobs, such as redirecting HTTP to HTTPS, the same care applies: one small typo can take the whole site down.

Nginx

Nginx does not read .htaccess files, so this rule goes into the site's configuration, inside the server block for your domain. The Nginx documentation says a location with the = modifier is an exact match, and when it matches, the search for a location stops. The access module documentation says deny all; denies all clients, and that the rules are checked in order until the first match.

Add this block inside the server block for your site.

location = /xmlrpc.php {
    deny all;
}

Because it is an exact match, it applies to that one file and nothing else on your site. After saving, test the configuration and reload Nginx with the commands below, which is standard practice on most Linux servers.

sudo nginx -t && sudo systemctl reload nginx

If nginx -t reports an error, it will not reload, and your live site keeps running on the old configuration. Fix the line it points to and try again. On managed hosting where you cannot touch the Nginx configuration, send the block above to your host and ask them to add it.

Step 4: Test it

Now run the same two commands from Step 1 again, exactly as before. Changing the command changes the test, so copy them from your notes.

This is the header check.

curl -I https://example.com/xmlrpc.php

This is the XML-RPC request.

curl -s -d '<?xml version="1.0"?><methodCall><methodName>system.listMethods</methodName></methodCall>' https://example.com/xmlrpc.php

Put the before and after results side by side. The next section explains how to read them.

How to check it worked

You are looking for a clear change between the "before" and "after" results. Here is how to judge each layer.

  • The server block is working when the status line has changed from what you recorded in Step 1 and the XML-RPC request no longer returns the XML list of methods. Record what your server returns instead, because the exact status code and reply text depend on your server and no official source states them.
  • The plugin is loaded when the Must-Use list in wp-admin shows "Disable XML-RPC". Remember that system.listMethods does not need a login, so on its own it does not prove the filter, and the server block is what silences the file.
  • Nothing else broke when your homepage, wp-admin, contact forms and anything you checked in "Before you start" still work.

Write the final status line in your site notes with the date. If the site changes hands or someone "fixes" the server config later, you will have a record of what it looked like when it was right.

One extra check is worth doing from a different network, such as your phone on mobile data. Some caching layers or proxies hand you a stored answer, and a second network helps you see what the rest of the world gets.

If you are already in the habit of checking your site from the command line, it pairs nicely with a routine to verify WordPress files with WP-CLI checksums. Both tests give you proof instead of a guess.

Troubleshooting

Most problems here come from one of a handful of causes. Each one below lists the symptom, the likely cause and the fix.

The whole site shows a server error after the Apache edit

  • Symptom: every page returns an error right after you save .htaccess.
  • Cause: usually a typo, a missing closing tag, or a server that does not allow these directives in .htaccess.
  • Fix: remove the block, confirm the site loads again, then paste the block back carefully. If it still fails, ask your host whether .htaccess overrides are allowed for access rules and whether the server is Apache 2.4.

The test result did not change at all

  • Symptom: the "after" output looks exactly like the "before" output.
  • Cause: you edited the wrong file or server block, Nginx was not reloaded, or a cache or proxy in front of the site is answering for it.
  • Fix: confirm you edited the .htaccess in the WordPress root or the server block for the right domain. On Nginx, run nginx -t and reload. Then test again from a second network, and purge any cache your host or CDN provides.

Jetpack says the connection is broken

  • Symptom: Jetpack shows a connection error or features stop working after your change.
  • Cause: Jetpack's support page says it uses XML-RPC to connect to WordPress.com, and blocking it breaks the connection.
  • Fix: remove the server block and the must-use plugin, then reconnect Jetpack. A Jetpack-connected site should leave xmlrpc.php open.

The must-use plugin does not appear in wp-admin

  • Symptom: no Must-Use list, or "Disable XML-RPC" is missing from it.
  • Cause: the file is in a subfolder, the folder name is wrong, the file does not end in .php, or the opening <?php line is missing.
  • Fix: make sure the path is exactly wp-content/mu-plugins/disable-xmlrpc.php with the file sitting directly in that folder, and that the first line is <?php.

A publishing app or old integration stopped working

  • Symptom: a tool that used to post to your site now fails to log in or connect.
  • Cause: that tool was using XML-RPC.
  • Fix: check whether the tool can connect through the REST API with an Application Password instead. If it cannot and you still need it, remove both layers until you can replace it.

Nginx refuses to reload

  • Symptom: nginx -t prints an error and the reload does not happen.
  • Cause: the location block was placed outside the server block, or a brace or semicolon is missing.
  • Fix: move the block inside the right server block, check every {, } and ;, then run nginx -t again.

Pro tips

A few habits that keep this tidy over the long run.

  • Keep Application Passwords as a separate decision. At the time of writing (22 November 2026), the WordPress documentation says Application Passwords are for API authentication, covering the REST API and, where enabled, XML-RPC, and that they are available over HTTPS by default. The core team's integration guide gives Application Passwords their own filter, wp_is_application_passwords_available, so they are a separate switch from the XML-RPC filter.
  • Turn off Application Passwords only if you never use them. If no app or service logs in to your REST API this way, you can add one more line to the same must-use plugin, shown below.
  • Keep both layers even if one feels like enough. The filter protects you if the server rule is lost during a migration, and the server rule protects you if someone deletes the plugin file.
  • Write it down. Add a line to your site notes saying XML-RPC is off at both layers, with the date and your test results.

If you decide you do not need Application Passwords, this line from the core integration guide switches them off, and it can sit in the same disable-xmlrpc.php file below the first filter.

add_filter( 'wp_is_application_passwords_available', '__return_false' );

Think twice before adding it. Some tools that move away from XML-RPC rely on Application Passwords with the REST API, so turning both off at once can leave them with no way in.

The one message worth forwarding

If you manage sites for clients or work with a small team, this is the message to send along.

Quick heads up on WordPress XML-RPC. Turning it off needs two layers. First, a must-use plugin in wp-content/mu-plugins with add_filter( 'xmlrpc_enabled', '__return_false' ); which switches off the XML-RPC methods that need a login. Second, a server rule that blocks xmlrpc.php (Apache: Require all denied inside a Files block, Nginx: location = /xmlrpc.php with deny all;). Run curl -I on xmlrpc.php before and after and keep both results. Do not do this on sites connected to Jetpack, because Jetpack uses XML-RPC. Application Passwords have their own filter and are a separate decision.

The takeaway is simple: a filter quiets the login part of XML-RPC, a server rule closes the file, and a before and after curl is the only proof that counts.

Reader questions

Does the `xmlrpc_enabled` filter turn off XML-RPC completely?

No. The WordPress developer reference says it filters whether XML-RPC methods requiring authentication are enabled, so xmlrpc.php still answers. Add a server-level block to stop the file from responding.

Why use a must-use plugin instead of a normal plugin?

Must-use plugins in wp-content/mu-plugins always load and cannot be disabled from wp-admin. That makes it hard for anyone to switch the setting off by accident.

Will blocking xmlrpc.php break Jetpack?

Yes. Jetpack's support page says it uses XML-RPC to connect to WordPress.com, and blocking it breaks the connection, so leave xmlrpc.php open on Jetpack-connected sites.

Does turning off XML-RPC also turn off Application Passwords?

Not through the XML-RPC filter. The WordPress documentation turns Application Passwords off with their own filter, `wp_is_application_passwords_available`, so they are a separate switch.

How do I know XML-RPC is really off?

Run curl -I and an XML-RPC POST against xmlrpc.php before and after your change, and record what your server returns each time. If the server block works, the status line changes and the list of methods no longer comes back.

Where does the Apache rule go?

Put the Files block in the .htaccess file in your WordPress root, outside the BEGIN WordPress and END WordPress markers. Load your homepage right after saving to make sure nothing broke.

Where does the Nginx rule go?

Put the exact-match location block inside the server block for your site, then test the configuration with nginx -t and reload Nginx. On managed hosting, ask your host to add it.

Sources & further reading

  1. WordPress Developer Reference: xmlrpc_enabled hook
  2. WordPress Codex: XML-RPC Support
  3. WordPress Developer Resources: XML-RPC API
  4. WordPress Advanced Administration: Must Use Plugins
  5. WordPress Advanced Administration: Application Passwords
  6. Make WordPress Core: Application Passwords Integration Guide
  7. Apache HTTP Server 2.4: core, Files directive
  8. Apache HTTP Server 2.4: mod_authz_core
  9. Nginx: ngx_http_core_module location
  10. Jetpack Support: Jetpack and XML-RPC

Originally published . About our editorial updates.

Your next project deserves a better foundation.

Explore hosting built for your next chapter.

Explore hosting

Find your next answer.

Search published guides and articles.

Ctrl / ⌘ K to open · Esc to close