http_headers_useragent filter-hookWP 2.7.0

Filters the user agent value sent with an HTTP request.

Usage

add_filter( 'http_headers_useragent', 'wp_kama_http_headers_useragent_filter', 10, 2 );

/**
 * Function for `http_headers_useragent` filter-hook.
 * 
 * @param string $user_agent WordPress user agent string.
 * @param string $url        The request URL.
 *
 * @return string
 */
function wp_kama_http_headers_useragent_filter( $user_agent, $url ){

	// filter...
	return $user_agent;
}
$user_agent(string)
WordPress user agent string.
$url(string)
The request URL.

Changelog

Since 2.7.0 Introduced.
Since 5.1.0 The $url parameter was added.

Where the hook is called

WP_Http::request()
http_headers_useragent
wp_xmlrpc_server::pingback_ping()
http_headers_useragent
wp-includes/class-wp-http.php 191
'user-agent'          => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ),
wp-includes/class-wp-xmlrpc-server.php 6927
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $pagelinkedfrom );

Where the hook is used in WordPress

Usage not found.