On this page
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.
Description
Attached to the ‘http_request_host_is_external’ filter.
Parameters
$is_externalbool Required$hoststring Required
Return
bool
Source
File: wp-includes/http.php. View all references
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 ];
}
Related
Uses
| Uses | Description |
|---|---|
| get_network() wp-includes/ms-network.php | Retrieves network data given a network ID or network object. |
| wpdb::get_var() wp-includes/class-wpdb.php | Retrieves one variable from the database. |
| wpdb::prepare() wp-includes/class-wpdb.php | Prepares a SQL query for safe execution. |
Changelog
| Version | Description |
|---|---|
| 3.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/ms_allowed_http_request_hosts