Filter hook 'http_request_reject_unsafe_urls'

in WP Core File wp-includes/class-wp-http.php at line 221

View Source

http_request_reject_unsafe_urls

Filter Hook
Description
Filters whether to pass URLs through wp_http_validate_url() in an HTTP request.

Hook Information

File Location wp-includes/class-wp-http.php View on GitHub
Hook Type Filter
Line Number 221

Hook Parameters

Type Name Description
bool $pass_url Whether to pass URLs through wp_http_validate_url(). Default false.
string $url The request URL.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-http.php:221 - How this hook is used in WordPress core
<?php
 216  			 * @since 5.1.0 The `$url` parameter was added.
 217  			 *
 218  			 * @param bool   $pass_url Whether to pass URLs through wp_http_validate_url(). Default false.
 219  			 * @param string $url      The request URL.
 220  			 */
 221  			'reject_unsafe_urls'  => apply_filters( 'http_request_reject_unsafe_urls', false, $url ),
 222  			'blocking'            => true,
 223  			'headers'             => array(),
 224  			'cookies'             => array(),
 225  			'body'                => null,
 226  			'compress'            => false,

PHP Documentation

<?php
/**
			 * Filters whether to pass URLs through wp_http_validate_url() in an HTTP request.
			 *
			 * @since 3.6.0
			 * @since 5.1.0 The `$url` parameter was added.
			 *
			 * @param bool   $pass_url Whether to pass URLs through wp_http_validate_url(). Default false.
			 * @param string $url      The request URL.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-http.php
Related Hooks

Related hooks will be displayed here in future updates.