[wp-trac] [WordPress Trac] #43258: Output buffer template rendering and add filter for post-processing (e.g. caching, optimization)

WordPress Trac noreply at wordpress.org
Thu Mar 13 16:45:37 UTC 2025


#43258: Output buffer template rendering and add filter for post-processing (e.g.
caching, optimization)
-----------------------------+--------------------------------
 Reporter:  nextendweb       |       Owner:  westonruter
     Type:  enhancement      |      Status:  accepted
 Priority:  normal           |   Milestone:  6.9
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  has-patch early  |     Focuses:  docs, performance
-----------------------------+--------------------------------

Comment (by westonruter):

 I've updated the drafted PR to look at the content type for the response,
 and if it is HTML, then it applies a `wp_output_buffer_html` filter.
 (Currently, if the output is not HTML then no filter applies.) By having a
 dedicated filter just for the HTML response we avoid situations where a
 template, for example, returns a non-HTML content type (such as in the
 case of serving robots.txt or feeds), and then a filter corrupts the
 response assuming it is HTML.

 I also added an `wp_final_output_buffer` action which is passed the final
 output buffer after filtering, regardless of the content type. This can be
 used by caching plugins to stash the response for future serving.

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


More information about the wp-trac mailing list