XML-RPC in WordPress: what it is and whether to switch it off

WordPress & CMS·· 40 views· 2 min read

The short answer: xmlrpc.php is an old WordPress file that lets outside programs publish to your site. Most sites no longer need it, and bots love it for guessing passwords. If you do not use an app that depends on it, you can block it; if you do, leave it as it is.

Do you need it?

If you use… Do you need XML-RPC?
Only the WordPress dashboard, in the browser No. The dashboard does not use it.
The WordPress mobile app, on older sites You might, depending on the version. Test after blocking.
Plugins that connect the site to an outside service Some do (check the plugin’s documentation). Test after blocking.
Publishing from an office program or an external editor Older ones do; newer ones use another route.
None of the above You can block it. One door less left open.

Blocking it, step by step

1 Take a copy of the .htaccess file in the site folder: What to back up before you update.
2 Pick a route. The simplest is a security plugin with a “disable XML-RPC” option. The other is to add these lines to .htaccess: <Files xmlrpc.php>
Require all denied
</Files>
3 Open the address your-domain.com/xmlrpc.php. If blocked, you should see “403 Forbidden” (or the equivalent); before, it said “XML-RPC server accepts POST requests only”.
4 Test what you use: publish a test post and confirm the apps connected to the site still work. If one fails, take the lines out of .htaccess.
5 If the site gave a 500 error after saving .htaccess, go back to the copy: Error 500.
Blocking XML-RPC does not replace the rest of the protection. Keep a strong password, a captcha and the login attempt limit: Protecting the WordPress login. It is one piece, not the whole defence.
A burst of requests to xmlrpc.php with nobody using it is a sign of attack: DDoS attack or just a traffic spike.

Not sure whether your site needs it? Open a ticket with the address and the names of your plugins.

Open a support ticket

SEE ALSO

Protecting the WordPress login: three steps in order of effect

ModSecurity and web application firewalls: what they do, and what to do when one blocks you

Installing WordPress plugins: where, which ones, and how many

RECOMMENDED PRODUCT

WordPress hosting

One-click install, updates handled, and speed that holds up. from R118.80/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.