申し訳ありません、ティム。ここ数日留守にしていました。このサポートには discourse_request メソッドの調整が必要なようです。来週PRを作成しますが、マージされるまでさらに1週間かかるでしょう。
それよりも早く必要な場合は、次のように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( /* 使用しているエンドポイントに固有 */ );
$url = /* 使用しているエンドポイントの絶対URL */;
$opts = array(
'headers' => $headers,
'body' => json_encode( $body ),
'method' => 'PUT'
);
$result = wp_remote_request( $url, $opts );