allowed_http_request_hosts() WordPress Function

The allowed_http_request_hosts() function is used to specify which hosts are allowed to make HTTP requests to the WordPress site. This is useful for restricting access to external sites or services.

allowed_http_request_hosts( bool $is_external, string $host ) #

Mark allowed redirect hosts safe for HTTP requests as well.


Description

Attached to the ‘http_request_host_is_external’ filter.


Top ↑

Parameters

$is_external

(bool)(Required)

$host

(string)(Required)


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/http.php

function allowed_http_request_hosts( $is_external, $host ) {
	if ( ! $is_external && wp_validate_redirect( 'http://' . $host ) ) {
		$is_external = true;
	}
	return $is_external;
}


Top ↑

Changelog

Changelog
VersionDescription
3.6.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.