A WordPress-centric search engine for devs and theme authors



wp_get_server_protocol ›

Since4.4.0
Deprecatedn/a
wp_get_server_protocol ( No parameters )
Returns:
  • (string) The HTTP protocol. Default: HTTP/1.0.
Defined at:
Codex:

Return the HTTP protocol sent by the server.



Source

function wp_get_server_protocol() {
	$protocol = $_SERVER['SERVER_PROTOCOL'];
	if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
		$protocol = 'HTTP/1.0';
	}
	return $protocol;
}