Skip to main content
Login Join
Snippet · PHP

Disable XML-RPC API

Shared by Darshit Rajyaguru · May 14, 2026 · @init

1 copy
38 views
1 upvote
Back to Snippets

Disables XML-RPC endpoint to reduce brute-force and pingback attacks.

add_filter( 'xmlrpc_enabled', '__return_false' );

add_filter( 'wp_headers', function( $headers ) {
	unset( $headers['X-Pingback'] );
	return $headers;
} );
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