pingback_useragent

Filters the user agent sent when pinging-back a URL.

Description

apply_filters( 'pingback_useragent', (string) $client_useragent_wordpress_get_bloginfo_version, (string) $client_useragent, (string) $pingback_server_url, (string) $pagelinkedto, (string) $pagelinkedfrom ); 

Parameters (5)

0. $client_useragent_wordpress_get_bloginfo_version (string)
The user agent concatenated with -- WordPress/ and the WordPress version.
1. $client_useragent (string)
The client useragent.
2. $pingback_server_url (string)
The server URL being linked to.
3. $pagelinkedto (string)
URL of page linked to.
4. $pagelinkedfrom (string)
URL of page linked from.

Usage

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

Defined (1)

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

/wp-includes/comment.php  
  1. $client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . get_bloginfo( 'version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom );