http_allowed_safe_ports
Controls the list of ports considered safe in HTTP API.
Allows to change and allow external requests for the HTTP request.
Usage
add_filter( 'http_allowed_safe_ports', 'wp_kama_http_allowed_safe_ports_filter', 10, 3 ); /** * Function for `http_allowed_safe_ports` filter-hook. * * @param int[] $allowed_ports Array of integers for valid ports. * @param string $host Host name of the requested URL. * @param string $url Requested URL. * * @return int[] */ function wp_kama_http_allowed_safe_ports_filter( $allowed_ports, $host, $url ){ // filter... return $allowed_ports; }
- $allowed_ports(int[])
- Array of integers for valid ports.
- $host(string)
- Host name of the requested URL.
- $url(string)
- Requested URL.
Changelog
Since 5.9.0 | Introduced. |
Where the hook is called
http_allowed_safe_ports
wp-includes/http.php 638
$allowed_ports = apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url );