Filter hook 'rest_request_from_url'

in WP Core File wp-includes/rest-api/class-wp-rest-request.php at line 1078

View Source

rest_request_from_url

Filter Hook
Description
Filters the REST API request generated from a URL.

Hook Information

File Location wp-includes/rest-api/class-wp-rest-request.php View on GitHub
Hook Type Filter
Line Number 1078

Hook Parameters

Type Name Description
WP_REST_Request|false $request Generated request object, or false if URL could not be parsed.
string $url URL the request was generated from.

Usage Examples

Basic Usage
<?php
// Hook into rest_request_from_url
add_filter('rest_request_from_url', 'my_custom_filter', 10, 2);

function my_custom_filter($request, $url) {
    // Your custom filtering logic here
    return $request;
}

Source Code Context

wp-includes/rest-api/class-wp-rest-request.php:1078 - How this hook is used in WordPress core
<?php
1073  		 *
1074  		 * @param WP_REST_Request|false $request Generated request object, or false if URL
1075  		 *                                       could not be parsed.
1076  		 * @param string                $url     URL the request was generated from.
1077  		 */
1078  		return apply_filters( 'rest_request_from_url', $request, $url );
1079  	}
1080  }

PHP Documentation

<?php
/**
		 * Filters the REST API request generated from a URL.
		 *
		 * @since 4.5.0
		 *
		 * @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.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/rest-api/class-wp-rest-request.php
Related Hooks

Related hooks will be displayed here in future updates.