How to call wp plugin REST functions without curl?

You can internally route REST API requests using rest_do_request and a WP_REST_Request object. $request = new WP_REST_Request( ‘GET’, ‘/fb_connect’ ); $request->set_param( ‘x’, true ); // You can also use it this way: $request[‘y’] = true; $request[‘z’] = true; $response = rest_do_request( $request );

Setting cookies in WP REST API requests

Adding this line to my $.ajax call fixed the problem for me. $.ajax({ xhrFields: { withCredentials: true }, // the rest… Sidenote: this requires the following header to be set on the server-side, which is enabled by default with the REST API (it seems). Access-Control-Allow-Credentials:true