http_headers_useragent

Filters the user agent value sent with an HTTP request.

Description

apply_filters( 'http_headers_useragent', (string) $wordpress_get_bloginfo_version_get_bloginfo_url ); 

Parameters (1)

0. $wordpress_get_bloginfo_version_get_bloginfo_url (string) => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' )
The wordpress get bloginfo version get bloginfo url.

Usage

To run the hook, copy the example below.
  1. $wordpress_get_bloginfo_version_get_bloginfo_url = apply_filters( 'http_headers_useragent', $wordpress_get_bloginfo_version_get_bloginfo_url ); 
  2.  
  3. if ( !empty( $wordpress_get_bloginfo_version_get_bloginfo_url ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the http_headers_useragent callback 
  2. function filter_http_headers_useragent( $wordpress_get_bloginfo_version_get_bloginfo_url ) { 
  3. // make filter magic happen here... 
  4. return $wordpress_get_bloginfo_version_get_bloginfo_url
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'http_headers_useragent', 'filter_http_headers_useragent', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'http_headers_useragent', 'filter_http_headers_useragent', 10, 1 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-includes/class-http.php  
  1. 'user-agent' => apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) ), 
/wp-includes/class-wp-xmlrpc-server.php  
  1. $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' ) );