[ Index ]

PHP Cross Reference of WordPress




/wp-includes/rest-api/endpoints/ -> class-wp-rest-search-controller.php (summary)

REST API: WP_REST_Search_Controller class

File Size: 387 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Search_Controller:: (9 methods):

Class: WP_REST_Search_Controller  - X-Ref

Core class to search through all WordPress content via the REST API.

__construct( array $search_handlers )   X-Ref

since: 5.0.0
param: array $search_handlers List of search handlers to use in the controller. Each search

register_routes()   X-Ref
Registers the routes for the search controller.

since: 5.0.0

get_items_permission_check( $request )   X-Ref
Checks if a given request has access to search content.

since: 5.0.0
return: true|WP_Error True if the request has search access, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.

get_items( $request )   X-Ref
Retrieves a collection of search results.

since: 5.0.0
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

prepare_item_for_response( $item, $request )   X-Ref
Prepares a single search result for response.

since: 5.0.0
since: 5.6.0 The `$id` parameter can accept a string.
since: 5.9.0 Renamed `$id` to `$item` to match parent class for PHP 8 named parameter support.
return: WP_REST_Response Response object.
param: int|string      $item    ID of the item to prepare.
param: WP_REST_Request $request Request object.

get_item_schema()   X-Ref
Retrieves the item schema, conforming to JSON Schema.

since: 5.0.0
return: array Item schema data.

get_collection_params()   X-Ref
Retrieves the query params for the search results collection.

since: 5.0.0
return: array Collection parameters.

sanitize_subtypes( $subtypes, $request, $parameter )   X-Ref
Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included.

since: 5.0.0
return: array|WP_Error List of valid subtypes, or WP_Error object on failure.
param: string|array    $subtypes  One or more subtypes.
param: WP_REST_Request $request   Full details about the request.
param: string          $parameter Parameter name.

get_search_handler( $request )   X-Ref
Gets the search handler to handle the current request.

since: 5.0.0
return: WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

Generated: Thu Jun 20 01:00:02 2024 Cross-referenced by PHPXref 0.7.1