llms_rest_get_api_endpoint_data( string $endpoint, array $params = array() )
Get data from a WP Rest API endpoint.
Parameters Parameters
- $endpoint
-
(string) (Required) API endpoint, eg "/llms/v1/courses".
- $params
-
(array) (Optional) Query params to add to the request.
Default value: array()
Return Return
(array|WP_Error)
Source Source
File: libraries/lifterlms-rest/includes/llms-rest-functions.php
function llms_rest_get_api_endpoint_data( $endpoint, $params = array() ) { $req = new WP_Rest_Request( 'GET', $endpoint ); if ( $params ) { $req->set_query_params( $params ); } $res = rest_do_request( $req ); $server = rest_get_server(); $json = wp_json_encode( $server->response_to_data( $res, false ) ); return json_decode( $json, true ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |