Skip to content

Commit 970706f

Browse files
Eliminate closure in favor of repeating the do_action() call
Co-authored-by: Peter Wilson <[email protected]>
1 parent a3f9ddb commit 970706f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/wp-includes/template.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,7 +973,8 @@ function wp_finalize_template_enhancement_output_buffer( string $output, int $ph
973973

974974
// If the content type is not HTML, short-circuit since it is not relevant for enhancement.
975975
if ( ! $is_html_content_type ) {
976-
$do_send_late_headers( $output );
976+
/** This action is documented in wp-includes/template.php */
977+
do_action( 'wp_send_late_headers', $output );
977978
return $output;
978979
}
979980

@@ -996,7 +997,18 @@ function wp_finalize_template_enhancement_output_buffer( string $output, int $ph
996997
*/
997998
$filtered_output = (string) apply_filters( 'wp_template_enhancement_output_buffer', $filtered_output, $output );
998999

999-
$do_send_late_headers( $filtered_output );
1000+
/**
1001+
* Fires at the last moment HTTP headers may be sent.
1002+
*
1003+
* This happens immediately before the template enhancement output buffer is flushed. This is in contrast with
1004+
* the {@see 'send_headers'} action which fires after the initial headers have been sent before the template
1005+
* has begun rendering, and thus does not depend on output buffering.
1006+
*
1007+
* @since 6.9.0
1008+
*
1009+
* @param string $output Output buffer.
1010+
*/
1011+
do_action( 'wp_send_late_headers', $filtered_output );
10001012

10011013
return $filtered_output;
10021014
}

0 commit comments

Comments
 (0)