Uses
Uses | Description |
---|---|
wp-includes/l10n.php: __() | Retrieve the translation of $text. |
wp-includes/functions.php: _doing_it_wrong() | Mark something as being incorrectly called. |
Constructor.
(array) (Required) List of search handlers to use in the controller. Each search handler instance must extend the WP_REST_Search_Handler
class.
File: wp-includes/rest-api/endpoints/class-wp-rest-search-controller.php
public function __construct( array $search_handlers ) { $this->namespace = 'wp/v2'; $this->rest_base = 'search'; foreach ( $search_handlers as $search_handler ) { if ( ! $search_handler instanceof WP_REST_Search_Handler ) { _doing_it_wrong( __METHOD__, /* translators: %s: PHP class name. */ sprintf( __( 'REST search handlers must extend the %s class.' ), 'WP_REST_Search_Handler' ), '5.0.0' ); continue; } $this->search_handlers[ $search_handler->get_type() ] = $search_handler; } }
Version | Description |
---|---|
5.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_search_controller/__construct