WordPress / WordPress/performance
Reuse template enhancement output buffer in Optimization Detective for WP 6.9
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 461
- Forks
- 165
- Avg merge
- 11h 12m
- Merged PRs (30d)
- 28
Description
Instead of Optimization Detective hackily opening its own output buffer via od_buffer_output() during the template_include filter:
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 );
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with plugins/optimization-detective/hooks.php and plugins/optimization-detective/optimization.php, reading the existing od_buffer_output() and od_template_output_buffer() integration. Verify the WordPress 6.9 function and filters described in the issue, then confirm Optimization Detective reuses the template enhancement buffer when available while retaining its existing fallback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100