ms_allowed_http_request_hosts( bool $is_external, string $host )

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

Description Description

Attached to the ‘http_request_host_is_external’ filter.

Parameters Parameters


(bool) (Required)


(string) (Required)

Top ↑

Return Return


Top ↑

Source Source

File: wp-includes/http.php

function ms_allowed_http_request_hosts( $is_external, $host ) {
	global $wpdb;
	static $queried = array();
	if ( $is_external )
		return $is_external;
	if ( $host === get_network()->domain )
		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 ];

Top ↑

Changelog Changelog

Version Description
3.6.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.