[wp-trac] [WordPress Trac] #64126: Sending late HTTP headers not facilitated by template enhancement output buffer
WordPress Trac
noreply at wordpress.org
Tue Oct 21 15:11:07 UTC 2025
#64126: Sending late HTTP headers not facilitated by template enhancement output
buffer
--------------------------+--------------------------
Reporter: westonruter | Owner: westonruter
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 6.9
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses: performance
--------------------------+--------------------------
Description changed by westonruter:
Old description:
> With #43258 there is now an opt-in way for core to output buffer a
> rendered template. Output buffers are useful not only for modifying the
> response body, but also for sending late headers, such as `Server-
> Timing`:
>
> * https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-tests
> /mu-plugins/server-timing.php
> * https://github.com/WordPress/performance/blob/trunk/plugins
> /performance-lab/includes/server-timing/class-perflab-server-timing.php
>
> The former is currently facilitated via the
> `wp_template_enhancement_output_buffer` filter, but the latter is not.
> There is no dedicated action to fire after the filters have applied and
> right before the output buffer callback returns to send the HTTP response
> body.
>
> Plugins which need to send a `Server-Timing` header after the template
> has been rendered shouldn't have to resort to hacking the
> `wp_template_enhancement_output_buffer` filter to run at `PHP_INT_MAX`
> while passing through the `$buffer` unchanged.
New description:
With #43258 there is now an opt-in way for core to output buffer a
rendered template. Output buffers are useful not only for modifying the
response body, but also for sending late headers, such as `Server-Timing`:
* https://github.com/WordPress/gutenberg/blob/trunk/packages/e2e-tests/mu-
plugins/server-timing.php
* https://github.com/WordPress/performance/blob/trunk/plugins/performance-
lab/includes/server-timing/class-perflab-server-timing.php
The former is currently facilitated via the
`wp_template_enhancement_output_buffer` filter, but the latter is not.
There is no dedicated action to fire after the filters have applied and
right before the output buffer callback returns to send the HTTP response
body.
Plugins which need to send a `Server-Timing` header after the template has
been rendered shouldn't have to resort to hacking the
`wp_template_enhancement_output_buffer` filter to run at `PHP_INT_MAX`
while passing through the `$buffer` unchanged.
Related: #64108
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64126#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list