WPDev.one
Core Class

WP_REST_Search_Controller

class WP_REST_Search_Controller // Constructor: function Object() { [native code] }

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

Methods 9 methods

Method / Return Description
__construct()
void

Constructor.

Parameters: $search_handlers: array
register_routes()
void

Registers the routes for the search controller.

get_items_permission_check()
(true

Checks if a given request has access to search content.

Parameters: $request: mixed
get_items()
(WP_REST_Response

Retrieves a collection of search results.

Parameters: $request: mixed
prepare_item_for_response()
WP_REST_Response

Prepares a single search result for response.

Parameters: $item: mixed, $request: mixed
get_item_schema()
array

Retrieves the item schema, conforming to JSON Schema.

get_collection_params()
array

Retrieves the query params for the search results collection.

sanitize_subtypes()
(string[]

Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included.

Parameters: $subtypes: mixed, $request: mixed, $parameter: mixed
get_search_handler()
(WP_REST_Search_Handler

Gets the search handler to handle the current request.

Parameters: $request: mixed

Properties

Property / Type Description
$search_handlers
mixed
public
No description available.

Class Information

Since Version
5.0.0
Source File
wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
Advertisement