ms_allowed_http_request_hosts() WP 3.6.0
Adds any domain in a multisite installation for safe HTTP requests to the allowed list.
Attached to the 'http_request_host_is_external' filter.
No Hooks.
Return
true/false.
Usage
ms_allowed_http_request_hosts( $is_external, $host );
- $is_external(true/false) (required)
- $host(string) (required)
Notes
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
Since 3.6.0 | Introduced. |
Code of ms_allowed_http_request_hosts() ms allowed http request hosts WP 5.6
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 ];
}