wp_get_server_protocol() WP 4.4.0
Return the HTTP protocol sent by the server.
No Hooks.
Return
String
. The HTTP protocol.0.
Usage
wp_get_server_protocol();
Changelog
Since 4.4.0 | Introduced. |
Code of wp_get_server_protocol() wp get server protocol WP 5.7
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' ), true ) ) {
$protocol = 'HTTP/1.0';
}
return $protocol;
}