Title: wp_get_server_protocol
Published: December 9, 2015
Last modified: February 24, 2026

---

# wp_get_server_protocol(): string

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#wp--skip-link--target)

Returns the HTTP protocol sent by the server.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#return)󠁿

 string The HTTP protocol. Default: HTTP/1.0.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/load.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/load.php#L15)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/load.php#L15-L23)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_check_php_mysql_versions()](https://developer.wordpress.org/reference/functions/wp_check_php_mysql_versions/)`wp-includes/load.php` |

Checks the server requirements.

  | 
| [status_header()](https://developer.wordpress.org/reference/functions/status_header/)`wp-includes/functions.php` |

Sets HTTP status header.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_get_server_protocol/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.4.0](https://developer.wordpress.org/reference/since/4.4.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_get_server_protocol%2F)
before being able to contribute a note or feedback.