ms_allowed_http_request_hosts

Whitelists any domain in a multisite installation for safe HTTP requests.

Description

ms_allowed_http_request_hosts( (bool) $is_external, (string) $host ); 

Attached to the filter.

Parameters (2)

0. $is_external (bool)
The is external.
1. $host (string)
The host.

Usage

  1. if ( !function_exists( 'ms_allowed_http_request_hosts' ) ) { 
  2. require_once ABSPATH . WPINC . '/http.php'; 
  3.  
  4. // The is external. 
  5. $is_external = true; 
  6.  
  7. // The host. 
  8. $host = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = ms_allowed_http_request_hosts($is_external, $host); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/http.php  
  1. function ms_allowed_http_request_hosts( $is_external, $host ) { 
  2. global $wpdb; 
  3. static $queried = array(); 
  4. if ( $is_external ) 
  5. return $is_external; 
  6. if ( $host === get_network()->domain ) 
  7. return true; 
  8. if ( isset( $queried[ $host ] ) ) 
  9. return $queried[ $host ]; 
  10. $queried[ $host ] = (bool) $wpdb->get_var( $wpdb->prepare( "SELECT domain FROM $wpdb->blogs WHERE domain = %s LIMIT 1", $host ) ); 
  11. return $queried[ $host ];