函数原型
ms_allowed_http_request_hosts( bool $is_external, string $host ): bool
函数描述
Adds any domain in a multisite installation for safe HTTP requests to the allowed list.
是否弃用
未弃用
函数参数
-
$is_external
bool
Required -
$host
string
Required
函数返回值
bool
函数位置
File: wp-includes/http.php.
函数源码
function ms_allowed_http_request_hosts( $is_external, $host ) {
global $wpdb;
static $queried = array();
if ( $is_external ) {
return $is_external;
}
if ( get_network()->domain === $host ) {
return true;
}
if ( isset( $queried[ $host ] ) ) {
return $queried[ $host ];
}
$queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) );
return $queried[ $host ];
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |

