wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



ms_allowed_http_request_hosts › WordPress Function

Depuis3.6.0
Dépréciéen/a
ms_allowed_http_request_hosts ( $is_external, $host )
Paramètres: (2)
  • (bool) $is_external
    Requis: Oui
  • (string) $host
    Requis: Oui
Retourne:
  • (bool)
Défini(e) dans:
Codex:

Adds any domain in a multisite installation for safe HTTP requests to the allowed list.

Attached to the {@see 'http_request_host_is_external'} filter.


Source

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 ];
}