ms_allowed_http_request_hosts()
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. |
ms_allowed_http_request_hosts() ms allowed http request hosts code WP 6.7.1
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 ]; }