name ]. Filterable for other * XML-RPC clients: `aicom_xmlrpc_needed_by`. */ public static function needed_by(): array { $known = [ 'jetpack/jetpack.php' => 'Jetpack', ]; $active = (array) get_option( 'active_plugins', [] ); if ( is_multisite() ) { $active = array_merge( $active, array_keys( (array) get_site_option( 'active_sitewide_plugins', [] ) ) ); } $needed = array_intersect_key( $known, array_flip( $active ) ); return (array) apply_filters( 'aicom_xmlrpc_needed_by', $needed ); } /** plugins_loaded, priority 1 — before the XML-RPC server is built. */ public static function bootstrap(): void { if ( self::is_disabled_by_setting() ) { self::block( __( 'XML-RPC is disabled on this site.', 'aicom' ) ); } } /** * Refuse xmlrpc.php outright and report XML-RPC as off. The `xmlrpc_enabled` filter alone only stops * authenticated methods; system.listMethods (defined in IXR_Server) is not filterable, so it would * still leak the method list — hence the 403 before WordPress builds the XML-RPC server. */ public static function block( string $message ): void { if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { status_header( 403 ); header( 'Content-Type: text/plain; charset=UTF-8' ); echo esc_html( $message ); exit; } add_filter( 'xmlrpc_enabled', '__return_false' ); } }