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.


Top ↑

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;
}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.