pre_http_send_through_proxy
云策文档标注
概述
pre_http_send_through_proxy 是一个 WordPress 过滤器,用于控制 HTTP 请求是否通过代理发送。开发者可以通过此 Hook 动态决定请求的代理行为。
关键要点
- 过滤器名称:pre_http_send_through_proxy,用于在发送 HTTP 请求前决定是否使用代理。
- 返回值:返回 false 绕过代理,返回 true 通过代理发送,返回 null 则跳过此过滤器。
- 参数:包括 $override(布尔值或 null,默认 null)、$uri(请求 URL)、$check(parse_url() 解析结果)、$home(站点 URL 解析结果)。
- 相关函数:WP_HTTP_Proxy::send_through_proxy() 使用此过滤器来确定代理行为。
- 版本历史:自 WordPress 3.5.0 版本引入。
原文内容
Filters whether to preempt sending the request through the proxy.
Description
Returning false will bypass the proxy; returning true will send the request through the proxy. Returning null bypasses the filter.
Parameters
$overridebool|null-
Whether to send the request through the proxy. Default null.
$uristring-
URL of the request.
$checkarray-
Associative array result of parsing the request URL with
parse_url(). $homearray-
Associative array result of parsing the site URL with
parse_url().
Source
$result = apply_filters( 'pre_http_send_through_proxy', null, $uri, $check, $home );
Changelog
| Version | Description |
|---|---|
| 3.5.0 | Introduced. |