adds return X-WP-Total and X-WP-TotalPages to the returned endpoint
after the foreach at 152
/*--- Start Customization --*/ return $this->create_response( $request, $posts, $search->found_posts ); /*--- end Customization --*/
and before the ensuring that the engine exists
`/**
Create the response.
@access public
@param \WP_REST_Request $request Full details about the request
@param array $data Raw response data
@param integer $total_posts total query posts count
adds return X-WP-Total and X-WP-TotalPages to the returned endpoint
after the foreach at 152
/*--- Start Customization --*/ return $this->create_response( $request, $posts, $search->found_posts ); /*--- end Customization --*/
and before the ensuring that the engine exists `/**
@return \WP_Error|\WP_HTTP_ResponseInterface|\WP_REST_Response */ public function create_response( $request, $data, $total_posts ) { $response = rest_ensure_response( $data ); $response->header( 'X-WP-Total', (int) $total_posts ); $max_pages = ceil( $total_posts / $request['posts_per_page'] ); $response->header( 'X-WP-TotalPages', (int) $max_pages );
}`