From e4fa7aaecdabe16ad8a8dd5dd16936f89491cc37 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 18 Oct 2022 16:11:16 +0000 Subject: [PATCH] Bootstrap/Load: Correct sending the `X-Pingback` header in `WP::send_headers()`. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The logic for sending the `X-Pingback` header for single posts that allow pings was recently moved from `WP::handle_404()`​ to a more appropriate place in `WP::send_headers()`. To check whether pings are open for a particular post, that logic relies on the `$wp_query` global, which is declared in `WP::handle_404()`, but not in `WP::send_headers()` This commit ensures that `$wp_query` is globalized in `WP::send_headers()` too, so that the check works as expected. Follow-up to [54250]. Props strategio, sabernhardt, dlh, davidbaumwald, SergeyBiryukov. Fixes #56840. Built from https://develop.svn.wordpress.org/trunk@54636 git-svn-id: http://core.svn.wordpress.org/trunk@54188 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/class-wp.php b/wp-includes/class-wp.php index 0a0a501ee0..67985c147b 100644 --- a/wp-includes/class-wp.php +++ b/wp-includes/class-wp.php @@ -410,8 +410,12 @@ class WP { * @since 2.0.0 * @since 4.4.0 `X-Pingback` header is added conditionally for single posts that allow pings. * @since 6.1.0 Runs after posts have been queried. + * + * @global WP_Query $wp_query WordPress Query object. */ public function send_headers() { + global $wp_query; + $headers = array(); $status = null; $exit_required = false; diff --git a/wp-includes/version.php b/wp-includes/version.php index 434aa247c9..3df4724caf 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-RC1-54635'; +$wp_version = '6.1-RC1-54636'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.