Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: http_headers_useragent

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
5811           if ( $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $post_ID, $pagelinkedfrom) ) )
5812                return $this->pingback_error( 48, __( 'The pingback has already been registered.' ) );
5813
5814           // very stupid, but gives time to the 'from' server to publish !
5815           sleep(1);
5816
5817           $remote_ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
5818
5819           /** This filter is documented in wp-includes/class-http.php */
5820           $user_agent = apply_filters( 'http_headers_useragent', 'WordPress/' . $GLOBALS['wp_version'] . '; ' . get_bloginfo( 'url' ) );
5821
5822           // Let's check the remote site
5823           $http_api_args = array(
5824                'timeout' => 10,
5825                'redirection' => 0,
5826                'limit_response_size' => 153600, // 150 KB
5827                'user-agent' => "$user_agent; verifying pingback from $remote_ip",
5828                'headers' => array(
5829                     'X-Pingback-Forwarded-For' => $remote_ip,