| [ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
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 |
WP_REST_Search_Controller:: (9 methods):
__construct()
register_routes()
get_items_permission_check()
get_items()
prepare_item_for_response()
get_item_schema()
get_collection_params()
sanitize_subtypes()
get_search_handler()
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 |
| Constructor. 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. return: true|WP_Error True if the request has search access, WP_Error object otherwise. since: 5.0.0 param: WP_REST_Request $request Full details about the request. |
| get_items( $request ) X-Ref |
| Retrieves a collection of search results. return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure. since: 5.0.0 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. return: WP_REST_Response Response object. 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. 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. return: array Item schema data. since: 5.0.0 |
| get_collection_params() X-Ref |
| Retrieves the query params for the search results collection. return: array Collection parameters. since: 5.0.0 |
| sanitize_subtypes( $subtypes, $request, $parameter ) X-Ref |
| Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included. return: array|WP_Error List of valid subtypes, or WP_Error object on failure. since: 5.0.0 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. return: WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure. since: 5.0.0 param: WP_REST_Request $request Full details about the request. |
| Generated: Thu Nov 13 01:00:24 2025 | Cross-referenced by PHPXref 0.7.1 |