rest_request_from_url filter-hookWP 4.5.0

Filters the REST API request generated from a URL.

Usage

add_filter( 'rest_request_from_url', 'wp_kama_rest_request_from_url_filter', 10, 2 );

/**
 * Function for `rest_request_from_url` filter-hook.
 * 
 * @param WP_REST_Request|false $request Generated request object, or false if URL could not be parsed.
 * @param string                $url     URL the request was generated from.
 *
 * @return WP_REST_Request|false
 */
function wp_kama_rest_request_from_url_filter( $request, $url ){

	// filter...
	return $request;
}
$request(WP_REST_Request|false)
Generated request object, or false if URL could not be parsed.
$url(string)
URL the request was generated from.

Changelog

Since 4.5.0 Introduced.

Where the hook is called

WP_REST_Request::from_url()
rest_request_from_url
wp-includes/rest-api/class-wp-rest-request.php 1058
return apply_filters( 'rest_request_from_url', $request, $url );

Where the hook is used in WordPress

Usage not found.