Skip to content

Instantly share code, notes, and snippets.

@tott
Last active August 29, 2015 14:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tott/a7638cb9b602425b3c87 to your computer and use it in GitHub Desktop.
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