抱歉 Tim,我这几天不在。看起来需要调整 discourse_request 方法来支持这个。我下周会为此提交一个 PR,合并可能还需要一周时间。
如果你想更快地得到结果,可以使用底层的 WP 方法,如下所示:
$api_credentials = DiscourseUtilities::get_api_credentials();
if ( is_wp_error( $api_credentials ) ) {
return $api_credentials;
}
$headers = array(
'Api-Key' => sanitize_key( $api_credentials['api_key'] ),
'Api-Username' => sanitize_text_field( $api_credentials['api_username'] ),
'Accept' => 'application/json',
);
$body = array( /* specific to the endpoint you're using */ );
$url = /* The absolute url for the endpoint you're using */ ;
$opts = array(
'headers' => $headers,
'body' => json_encode( $body ),
'method' => 'PUT'
);
$result = wp_remote_request( $url, $opts );