Filter hook 'pre_http_send_through_proxy'

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

View Source

pre_http_send_through_proxy

Filter Hook
Description
Filters whether to preempt sending the request through the proxy. Returning false will bypass the proxy; returning true will send the request through the proxy. Returning null bypasses the filter.

Hook Information

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

Hook Parameters

Type Name Description
bool|null $override Whether to send the request through the proxy. Default null.
string $uri URL of the request.
array $check Associative array result of parsing the request URL with `parse_url()`.
array $home Associative array result of parsing the site URL with `parse_url()`.

Usage Examples

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

function my_custom_filter($override, $uri, $check, $home) {
    // Your custom filtering logic here
    return $override;
}

Source Code Context

wp-includes/class-wp-http-proxy.php:194 - How this hook is used in WordPress core
<?php
 189  		 * @param bool|null $override Whether to send the request through the proxy. Default null.
 190  		 * @param string    $uri      URL of the request.
 191  		 * @param array     $check    Associative array result of parsing the request URL with `parse_url()`.
 192  		 * @param array     $home     Associative array result of parsing the site URL with `parse_url()`.
 193  		 */
 194  		$result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home );
 195  		if ( ! is_null( $result ) ) {
 196  			return $result;
 197  		}
 198  
 199  		if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] === $check['host'] ) ) {

PHP Documentation

<?php
/**
		 * Filters whether to preempt sending the request through the proxy.
		 *
		 * Returning false will bypass the proxy; returning true will send
		 * the request through the proxy. Returning null bypasses the filter.
		 *
		 * @since 3.5.0
		 *
		 * @param bool|null $override Whether to send the request through the proxy. Default null.
		 * @param string    $uri      URL of the request.
		 * @param array     $check    Associative array result of parsing the request URL with `parse_url()`.
		 * @param array     $home     Associative array result of parsing the site URL with `parse_url()`.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/class-wp-http-proxy.php
Related Hooks

Related hooks will be displayed here in future updates.