WP_REST_Response::set_matched_handler() WordPress Method
If you need to change the matched handler for a request after it has been registered, you can use the set_matched_handler() method. This is useful if you want to override the default behavior for a request, or if you need to change the handler based on some condition that can't be determined when the request is first registered. To change the matched handler, you need to pass two arguments to the set_matched_handler() method: the new handler callback and an optional array of conditions. The conditions array is used to specify when the new handler should be used. If no conditions are specified, the new handler will be used for all requests.
WP_REST_Response::set_matched_handler( array $handler ) #
Sets the handler that was responsible for generating the response.
Contents
Parameters
- $handler
(array)(Required)The matched handler.
Source
File: wp-includes/rest-api/class-wp-rest-response.php
public function set_matched_handler( $handler ) { $this->matched_handler = $handler; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |