REF : https://wpscholar.com/blog/internal-wp-rest-api-calls/
$api_data = array(
'post' => $post
);
$request = new WP_REST_Request( 'POST', '/gic/v1/subscriber' );
$request->set_query_params( $api_data );
$response = rest_do_request( $request );
$server = rest_get_server();
$data = $server->response_to_data( $response, false );
$json = wp_json_encode( $data );
$api_data = array(
'post' => $post
);
$request = new WP_REST_Request( 'POST', '/gic/v1/subscriber' );
$request->set_query_params( $api_data );
$response = rest_do_request( $request );
$server = rest_get_server();
$data = $server->response_to_data( $response, false );
$json = wp_json_encode( $data );
No comments:
Post a Comment