wp_safe_remote_head()WP 3.6.0

Retrieve the raw response from a safe HTTP request using the HEAD method.

This function is ideal when the HTTP request is being made to an arbitrary URL. The URL is validated to avoid redirection and request forgery attacks.

Хуков нет.


Массив|WP_Error. The response or WP_Error on failure.


wp_safe_remote_head( $url, $args );
$url(строка) (обязательный)
URL to retrieve.
Request arguments. See WP_Http::request() for information on accepted arguments.
По умолчанию: empty array


Список изменений

С версии 3.6.0 Введена.

Код wp_safe_remote_head() WP 6.5.5

function wp_safe_remote_head( $url, $args = array() ) {
	$args['reject_unsafe_urls'] = true;
	$http                       = _wp_http_get_object();
	return $http->head( $url, $args );