[wp-trac] [WordPress Trac] #56068: Send HTTP headers after querying posts in WP::main()

WordPress Trac noreply at wordpress.org
Tue Sep 20 13:10:49 UTC 2022


#56068: Send HTTP headers after querying posts in WP::main()
----------------------------------------+-----------------------------
 Reporter:  SergeyBiryukov              |       Owner:  SergeyBiryukov
     Type:  enhancement                 |      Status:  closed
 Priority:  normal                      |   Milestone:  6.2
Component:  Bootstrap/Load              |     Version:
 Severity:  normal                      |  Resolution:  fixed
 Keywords:  has-patch needs-unit-tests  |     Focuses:  performance
----------------------------------------+-----------------------------
Changes (by SergeyBiryukov):

 * owner:  (none) => SergeyBiryukov
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"54250" 54250]:
 {{{
 #!CommitTicketReference repository="" revision="54250"
 Bootstrap/Load: Send HTTP headers after querying posts in `WP::main()`.

 By running `WP::send_headers()` after posts have been queried, we can
 ensure that conditional tags like `is_front_page()`, `is_home()`, etc.
 work as expected.

 This provides better context and more flexibility when adjusting HTTP
 headers via the `wp_headers` filter or `send_headers` action.

 Previously, the earliest action where conditional tags worked correctly
 was `wp`.

 Includes moving the `X-Pingback` header, previously sent in
 `WP::handle_404()`​ after posts have been queried, to a more appropriate
 place in `WP::send_headers()`.

 Follow-up to [2627], [34442].

 Props jonoaldersonwp, joostdevalk, peterwilsoncc, adamsilverstein,
 SergeyBiryukov.
 Fixes #56068.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56068#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list