Make WordPress Core

Changeset 54636

Timestamp:
10/18/2022 04:09:50 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Bootstrap/Load: Correct sending the X-Pingback header in WP::send_headers().

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp.php

    r54250 r54636  
    411411     * @since 4.4.0 `X-Pingback` header is added conditionally for single posts that allow pings.
    412412     * @since 6.1.0 Runs after posts have been queried.
     413
     414
    413415     */
    414416    public function send_headers() {
     417
     418
    415419        $headers       = array();
    416420        $status        = null;
  • trunk/tests/phpunit/tests/wp/sendHeaders.php

    r54250 r54636  
    2020        $this->go_to( home_url() );
    2121    }
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
    2237}
Note: See TracChangeset for help on using the changeset viewer.