http_allowed_safe_ports хук-фильтрWP 5.9.0

Controls the list of ports considered safe in HTTP API.

Allows to change and allow external requests for the HTTP request.

Использование

add_filter( 'http_allowed_safe_ports', 'wp_kama_http_allowed_safe_ports_filter', 10, 3 );

/**
 * Function for `http_allowed_safe_ports` filter-hook.
 * 
 * @param array  $allowed_ports Array of integers for valid ports.
 * @param string $host          Host name of the requested URL.
 * @param string $url           Requested URL.
 *
 * @return array
 */
function wp_kama_http_allowed_safe_ports_filter( $allowed_ports, $host, $url ){

	// filter...
	return $allowed_ports;
}
$allowed_ports(массив)
Array of integers for valid ports.
$host(строка)
Host name of the requested URL.
$url(строка)
Requested URL.

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

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

Где вызывается хук

wp_http_validate_url()
http_allowed_safe_ports
wp-includes/http.php 596
$allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url );

Где используется хук в WordPress

Использование не найдено.