Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
workaround disabling xmlrpc from within wordpress mu-plugins file
/**
* Disable xmlrpc
*/
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
include_once(ABSPATH . WPINC . '/class-IXR.php');
class blocking_xmlrpc_server {
function serve_request() {
$response = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
die( $response->getXml() );
}
}
add_filter( 'wp_xmlrpc_server_class', function() {
return 'blocking_xmlrpc_server';
}, 1000 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment