From e774c95266b437dfa70fd4417a4a3bda385058dc Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 22 Sep 2015 18:46:43 +0000 Subject: [PATCH] PINGBACKS: rather than sending the `X-Pingback` HTTP header on every single request for fun, perhaps only send it on single posts with pings open. See #20226. git-svn-id: https://develop.svn.wordpress.org/trunk@34442 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php index 6d008c87da..44482dee0d 100644 --- a/src/wp-includes/class-wp.php +++ b/src/wp-includes/class-wp.php @@ -365,7 +365,7 @@ class WP { * @since 2.0.0 */ public function send_headers() { - $headers = array('X-Pingback' => get_bloginfo('pingback_url')); + $headers = array(); $status = null; $exit_required = false; @@ -595,6 +595,15 @@ class WP { // Never 404 for the admin, robots, or if we found posts. if ( is_admin() || is_robots() || $wp_query->posts ) { + + // Only set X-Pingback for single posts. + if ( is_single() ) { + $p = get_queried_object(); + if ( $p && pings_open( $p ) ) { + @header( 'X-Pingback: ' . get_bloginfo( 'pingback_url' ) ); + } + } + status_header( 200 ); return; }