From the xmlrpc_enabled
filter docs:
Contrary to the way it’s named, this filter does not control whether XML-RPC is fully enabled, rather, it only controls whether XML-RPC methods requiring authentication – such as for publishing purposes – are enabled.
To fully disable XMLRPC, you might be able to use the xmlrpc_methods
filter and return an empty array:
add_filter( 'xmlrpc_methods', 'wpse416991_disable_xmlrpc' );
/**
* Disables XMLRPC methods.
*
* @param array $methods The XMLRPC methods.
* @return array An empty array to disable all methods.
*/
function wpse416991_disable_xmlrpc( $methods ) {
return array();
}
Per @birgire’s comment, you could further simplify this using __return_empty_array()
:
add_filter( 'xmlrpc_methods', '__return_empty_array' );
If that doesn’t work, you can block access to the XMLRPC file in your .htaccess
file (though that’s outside of the WordPress scope):
<Files "xmlrpc.php">
Require all denied
</Files>