Filter hook 'http_request_version'

in WP Core File wp-includes/class-wp-http.php at line 201

View Source

http_request_version

Filter Hook
Description
Filters the version of the HTTP protocol used in a request.

Hook Information

File Location wp-includes/class-wp-http.php View on GitHub
Hook Type Filter
Line Number 201

Hook Parameters

Type Name Description
string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'.
string $url The request URL.

Usage Examples

Basic Usage
<?php
// Hook into http_request_version
add_filter('http_request_version', 'my_custom_filter', 10, 2);

function my_custom_filter($version, $url) {
    // Your custom filtering logic here
    return $version;
}

Source Code Context

wp-includes/class-wp-http.php:201 - How this hook is used in WordPress core
<?php
 196  			 * @since 5.1.0 The `$url` parameter was added.
 197  			 *
 198  			 * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'.
 199  			 * @param string $url     The request URL.
 200  			 */
 201  			'httpversion'         => apply_filters( 'http_request_version', '1.0', $url ),
 202  			/**
 203  			 * Filters the user agent value sent with an HTTP request.
 204  			 *
 205  			 * @since 2.7.0
 206  			 * @since 5.1.0 The `$url` parameter was added.

PHP Documentation

<?php
/**
			 * Filters the version of the HTTP protocol used in a request.
			 *
			 * @since 2.7.0
			 * @since 5.1.0 The `$url` parameter was added.
			 *
			 * @param string $version Version of HTTP used. Accepts '1.0' and '1.1'. Default '1.0'.
			 * @param string $url     The request URL.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp-http.php
Related Hooks

Related hooks will be displayed here in future updates.