Filter hook 'pingback_useragent'

in WP Core File wp-includes/comment.php at line 3203

View Source

pingback_useragent

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

Hook Information

File Location wp-includes/comment.php View on GitHub
Hook Type Filter
Line Number 3203

Hook Parameters

Type Name Description
string $concat_useragent The user agent concatenated with ' -- WordPress/' and the WordPress version.
string $useragent The useragent.
string $pingback_server_url The server URL being linked to.
string $pagelinkedto URL of page linked to.
string $pagelinkedfrom URL of page linked from.

Usage Examples

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

function my_custom_filter($concat_useragent, $useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom) {
    // Your custom filtering logic here
    return $concat_useragent;
}

Source Code Context

wp-includes/comment.php:3203 - How this hook is used in WordPress core
<?php
3198  			 * @param string $useragent           The useragent.
3199  			 * @param string $pingback_server_url The server URL being linked to.
3200  			 * @param string $pagelinkedto        URL of page linked to.
3201  			 * @param string $pagelinkedfrom      URL of page linked from.
3202  			 */
3203  			$client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . get_bloginfo( 'version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom );
3204  			// When set to true, this outputs debug messages by itself.
3205  			$client->debug = false;
3206  
3207  			$status = $client->query( 'pingback.ping', $pagelinkedfrom, $pagelinkedto );
3208  

PHP Documentation

<?php
/**
			 * Filters the user agent sent when pinging-back a URL.
			 *
			 * @since 2.9.0
			 *
			 * @param string $concat_useragent    The user agent concatenated with ' -- WordPress/'
			 *                                    and the WordPress version.
			 * @param string $useragent           The useragent.
			 * @param string $pingback_server_url The server URL being linked to.
			 * @param string $pagelinkedto        URL of page linked to.
			 * @param string $pagelinkedfrom      URL of page linked from.
			 */
Quick Info
  • Hook Type: Filter
  • Parameters: 5
  • File: wp-includes/comment.php
Related Hooks

Related hooks will be displayed here in future updates.