wp_get_server_protocol() WordPress Function
The wp_get_server_protocol() function is used to retrieve the name and version of the HTTP server software running on the server.
wp_get_server_protocol() #
Return the HTTP protocol sent by the server.
Return
(string) The HTTP protocol. Default: HTTP/1.0.
Source
File: wp-includes/load.php
function wp_get_server_protocol() {
$protocol = isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : '';
if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0', 'HTTP/3' ), true ) ) {
$protocol = 'HTTP/1.0';
}
return $protocol;
}
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |