- Timestamp:
- 03/02/2025 10:05:08 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
r57839 r59899 143 143 $ids = $result[ WP_REST_Search_Handler::RESULT_IDS ]; 144 144 145 $results = array(); 146 147 foreach ( $ids as $id ) { 148 $data = $this->prepare_item_for_response( $id, $request ); 149 $results[] = $this->prepare_response_for_collection( $data ); 145 $is_head_request = $request->is_method( 'HEAD' ); 146 if ( ! $is_head_request ) { 147 $results = array(); 148 149 foreach ( $ids as $id ) { 150 $data = $this->prepare_item_for_response( $id, $request ); 151 $results[] = $this->prepare_response_for_collection( $data ); 152 } 150 153 } 151 154 … … 163 166 } 164 167 165 $response = rest_ensure_response( $results );168 $response = $is_head_request ? new WP_REST_Response() : rest_ensure_response( $results ); 166 169 $response->header( 'X-WP-Total', $total ); 167 170 $response->header( 'X-WP-TotalPages', $max_pages );
Note: See TracChangeset
for help on using the changeset viewer.