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.


Parameters

$handler

(array)(Required)The matched handler.


Top ↑

Source

File: wp-includes/rest-api/class-wp-rest-response.php

	public function set_matched_handler( $handler ) {
		$this->matched_handler = $handler;
	}

Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.