Filter hook 'rest_prepare_url_details'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php at line 187

View Source

rest_prepare_url_details

Filter Hook
Description
Filters the URL data for the response.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php View on GitHub
Hook Type Filter
Line Number 187

Hook Parameters

Type Name Description
WP_REST_Response $response The response object.
string $url The requested URL.
WP_REST_Request $request Request object.
string $remote_url_response HTTP response body from the remote URL.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php:187 - How this hook is used in WordPress core
<?php
 182  		 * @param WP_REST_Response $response            The response object.
 183  		 * @param string           $url                 The requested URL.
 184  		 * @param WP_REST_Request  $request             Request object.
 185  		 * @param string           $remote_url_response HTTP response body from the remote URL.
 186  		 */
 187  		return apply_filters( 'rest_prepare_url_details', $response, $url, $request, $remote_url_response );
 188  	}
 189  
 190  	/**
 191  	 * Checks whether a given request has permission to read remote URLs.
 192  	 *

PHP Documentation

<?php
/**
		 * Filters the URL data for the response.
		 *
		 * @since 5.9.0
		 *
		 * @param WP_REST_Response $response            The response object.
		 * @param string           $url                 The requested URL.
		 * @param WP_REST_Request  $request             Request object.
		 * @param string           $remote_url_response HTTP response body from the remote URL.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php
Related Hooks

Related hooks will be displayed here in future updates.