Send data to 3rd party api with wp_remote_post on wp_login
The ‘body’ needs to be an array, not including the ‘json_encode($user)’ piece. $response = wp_remote_post( ‘myapp.com/endpoint’, array( ‘method’ => ‘POST’, ‘headers’ => array(‘Content-Type’ => ‘application/json; charset=utf-8’), ‘body’ => $user ) ); I have this in my function since I also had issues with the body being an object: if (is_object($user) && !is_array($user)) $user = json_decode(json_encode($user), … Read more