Instead of Optimization Detective hackily opening its own output buffer via od_buffer_output() during the template_include filter:
|
add_filter( 'template_include', 'od_buffer_output', PHP_INT_MAX ); |
In WordPress 6.9 we can now leverage the template enhancement output buffer introduced via Core-43258 (see r60936). When the wp_start_template_enhancement_output_buffer() function exists, we can skip starting our own output buffer:
if ( ! function_exists( 'wp_start_template_enhancement_output_buffer' ) ) {
add_filter( 'template_include', 'od_buffer_output', PHP_INT_MAX );
}
And then od_template_output_buffer() can be updated accordingly:
if ( function_exists( 'wp_start_template_enhancement_output_buffer' ) ) {
add_filter( 'wp_template_enhancement_output_buffer', $callback );
} else {
add_filter( 'od_template_output_buffer', $callback );
}
Instead of Optimization Detective hackily opening its own output buffer via
od_buffer_output()during thetemplate_includefilter:performance/plugins/optimization-detective/hooks.php
Line 19 in a5c444f
In WordPress 6.9 we can now leverage the template enhancement output buffer introduced via Core-43258 (see r60936). When the
wp_start_template_enhancement_output_buffer()function exists, we can skip starting our own output buffer:And then
od_template_output_buffer()can be updated accordingly: