How to retrieve _embed (etc) fields in get_posts custom query?
How to retrieve _embed (etc) fields in get_posts custom query?
How to retrieve _embed (etc) fields in get_posts custom query?
Filter custom post type returned from REST api
How to replecate the _fields parameter in custom REST api endpoint
Custom WP Rest API Endpoints from JSON Schema
In Rest API 2.0 is it possible to get some meta fields but not others?
Create settings page to enable or disable CPT
API request forbidden when requesting from same domain
I got that working 🙂 add_filter(‘rest_myRoute_query’, function($args, $request) { $fields = array(‘myCustomField’); foreach ($fields as $field) { if (! empty($request[$field])) { $args[‘meta_query’][] = array( ‘key’ => $field, ‘value’ => esc_sql($request[$field]), ); } } return $args; }, 10, 2);
WP REST API with Basic Auth at target website
You can check this: $api_endpoint=”https://url_to_API”; $api_args = array( ‘method’ => ‘GET’, ‘headers’ => array( ‘Accept’ => ‘application/json’, ‘any’ => ‘other’ ) ); $queries = array( ‘your_query’ => 1, ‘another_query’ => 5, ); $api_endpoint = add_query_arg( $queries, $api_endpoint ); $response = wp_remote_request( $api_endpoint, $api_args ); $response_code = wp_remote_retrieve_response_code( $response ) $data = json_decode( wp_remote_retrieve_body( $response ), … Read more