Filter hook 'rest_url_details_http_request_args'

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

View Source

rest_url_details_http_request_args

Filter Hook
Description
Filters the HTTP request args for URL data retrieval. Can be used to adjust response size limit and other WP_Http::request() args.

Hook Information

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

Hook Parameters

Type Name Description
array $args Arguments used for the HTTP request.
string $url The attempted URL.

Usage Examples

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

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

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php:252 - How this hook is used in WordPress core
<?php
 247  		 * @since 5.9.0
 248  		 *
 249  		 * @param array  $args Arguments used for the HTTP request.
 250  		 * @param string $url  The attempted URL.
 251  		 */
 252  		$args = apply_filters( 'rest_url_details_http_request_args', $args, $url );
 253  
 254  		$response = wp_safe_remote_get( $url, $args );
 255  
 256  		if ( WP_Http::OK !== wp_remote_retrieve_response_code( $response ) ) {
 257  			// Not saving the error response to cache since the error might be temporary.

PHP Documentation

<?php
/**
		 * Filters the HTTP request args for URL data retrieval.
		 *
		 * Can be used to adjust response size limit and other WP_Http::request() args.
		 *
		 * @since 5.9.0
		 *
		 * @param array  $args Arguments used for the HTTP request.
		 * @param string $url  The attempted URL.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php
Related Hooks

Related hooks will be displayed here in future updates.