remove notice in response from facets endpoint (ref. #94)

This commit is contained in:
eduardohumberto 2018-08-28 20:58:15 -03:00 committed by Mateus Machado Luna
parent 71a5ded568
commit 323da5f0e4
1 changed files with 7 additions and 1 deletions

View File

@ -62,7 +62,11 @@ class REST_Facets_Controller extends REST_Controller {
$response = $this->prepare_item_for_response($metadatum, $request );
return new \WP_REST_Response($response, 200);
$rest_response = new \WP_REST_Response($response, 200);
$rest_response->header('X-WP-Total', (int) count($response));
return $rest_response;
}
/**
@ -127,6 +131,8 @@ class REST_Facets_Controller extends REST_Controller {
$metadatum_id = $metadatum->get_id();
$offset = '';
$number = '';
$collection_id = ( isset($request['collection_id']) ) ? $request['collection_id'] : false;
if($request['offset'] >= 0 && $request['number'] >= 1){
$offset = $request['offset'];
$number = $request['number'];