I'm unable to use put http requests in WordPress.
https://codex.wordpress.org/HTTP_API
This link says you can do it through wp_remote_request()? But where to specify that ?
Can anyone help me with this? I need a code.
$body = array(
"status" => "publish"
);
$args = array(
'headers' => array(
'Content-Type' => 'application/json',
),
'body' => json_encode($body),
'method' => 'PUT'
);
$result = wp_remote_request( "http:300/wp-json/wp/post/1", $args );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With