PUT HTTP Request in HTTP API WordPress

I’m unable to use put http requests in WordPress.

https://codex.wordpress.org/HTTP_API

Read More

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.

Related posts

2 comments

  1. $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 );
    
  2. Like this

    $response = wp_remote_request( 'http://test.com/test', [
        'method' => 'PUT'
    ] );
    

Comments are closed.