The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Disable WordPress XML-RPC

Shared by Amit Dholiya · September 24, 2026 · @xmlrpc_enabled

8 views
1 upvote
Back to Snippets

XML-RPC is a WordPress feature that allows external applications to communicate with your website. When you do not use XML-RPC functionality, you can disable it with a simple filter.

Steps

  1. Add the code below to your theme’s functions.php.
  2. Save the changes.
  3. WordPress will disable XML-RPC methods that depend on the xmlrpc_enabled setting.
/**
 * Disable WordPress XML-RPC
 */
function custom_disable_xmlrpc( $enabled ) {
    return false;
}

add_filter(
    'xmlrpc_enabled',
    'custom_disable_xmlrpc'
);

Tested on

WordPress 7.1

Reported by the author on September 24, 2026. WPFolks has not verified this.

Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

0 comments