WordPress / WordPress/performance

Reuse template enhancement output buffer in Optimization Detective for WP 6.9

Open Beginner friendly
#2,224 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

[Plugin] Optimization Detective [Type] Enhancement ContributorDay
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:

https://github.com/WordPress/performance/blob/a5c444f27ffc09629005351ed9d0dd77e084ec8b/plugins/optimization-detective/hooks.php#L19

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.