[wp-trac] [WordPress Trac] #64126: Sending late HTTP headers not facilitated by template enhancement output buffer

WordPress Trac noreply at wordpress.org
Thu Oct 30 00:46:46 UTC 2025


#64126: Sending late HTTP headers not facilitated by template enhancement output
buffer
--------------------------------------+--------------------------
 Reporter:  westonruter               |       Owner:  westonruter
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.9
Component:  General                   |     Version:  trunk
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+--------------------------
Changes (by westonruter):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"61088" 61088]:
 {{{
 #!CommitTicketReference repository="" revision="61088"
 General: Add `wp_send_late_headers` action which fires right before the
 template enhancement output buffer is flushed.

 This adds a (missing) `wp_send_late_headers` action which fires right
 after the `wp_template_enhancement_output_buffer` filters have applied and
 right before the output buffer is flushed. The filtered output buffer is
 passed as an argument to the action so that plugins may do things like
 send an `ETag` header which is calculated from the content. This action
 eliminates the need for plugins to hack the
 `wp_template_enhancement_output_buffer` filter with a high priority to
 send a late response header. This action compliments the `send_headers`
 action which is commonly used to send HTTP headers before the template is
 rendered. Furthermore:

 * The template enhancement output buffer is now enabled by default if
 there is a callback added to either the
 `wp_template_enhancement_output_buffer` filter or the
 `wp_send_late_headers` action.
 * The `wp_start_template_enhancement_output_buffer()` callback for the
 `wp_before_include_template` action is increased from the default of 10 to
 1000. This goes with the previous point, so that plugins can add those
 filters and actions during the `wp_before_include_template` action without
 having to worry about adding them too late, that is, after
 `wp_start_template_enhancement_output_buffer()` has run.
 * The `wp_send_late_headers` action fires regardless of whether the
 buffered response is HTML.

 Developed in https://github.com/WordPress/wordpress-develop/pull/10381

 Follow-up to [60936].

 Props westonruter, peterwilsoncc, johnbillion.
 See #43258.
 Fixes #64126.
 }}}

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


More information about the wp-trac mailing list