oth old (pre-6.9) and new (6.9+) action names. */ add_action( 'abilities_api_init', array( __CLASS__, 'register_abilities' ) ); add_action( 'wp_abilities_api_init', array( __CLASS__, 'register_abilities' ) ); } /** * Register all configured abilities. */ public static function register_abilities(): void { // Only register abilities if this is an MCP endpoint request. // We check here (on abilities_api_init action) rather than earlier // because REST request detection requires the WordPress REST infrastructure // to be fully initialized. if ( ! MCPAdapterProvider::is_mcp_request() ) { return; } foreach ( self::get_configurations() as $config ) { RestAbilityFactory::register_controller_abilities( $config ); } } }