http_headers_useragent
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
http_headers_useragent
wp-includes/class-wp-http.php 193
'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $url ),
wp-includes/class-wp-xmlrpc-server.php 6960
$user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ), $pagelinkedfrom );