wp_finalized_template_enhancement_output_buffer action-hookWP 6.9.0

Fires after the template enhancement output buffer has been finalized.

This happens immediately before the template enhancement output buffer is flushed. No output may be printed at this action; prior to PHP 8.5, the output will be silently omitted, whereas afterward a deprecation notice will be emitted. Nevertheless, HTTP headers may be sent, which makes this action complimentary to the send_headers action, in which headers may be sent before the template has started rendering. In contrast, this wp_finalized_template_enhancement_output_buffer is the possible point at which HTTP headers can be sent. This action does not fire if the "template enhancement output buffer" was not started. This output buffer is automatically started if this action is added before wp_start_template_enhancement_output_buffer() runs at the wp_before_include_template action with priority 1000. Before this point, the output buffer will also be started automatically if there was a wp_template_enhancement_output_buffer filter added, or if the wp_should_output_buffer_template_for_enhancement filter is made to return true.

Important: Because this action fires inside an output buffer callback (i.e. display handler), any callbacks added to the action must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error: "Cannot use output buffering in output buffering display handlers."

Usage

add_action( 'wp_finalized_template_enhancement_output_buffer', 'wp_kama_finalized_template_enhancement_output_buffer_action' );

/**
 * Function for `wp_finalized_template_enhancement_output_buffer` action-hook.
 * 
 * @param string $output Finalized output buffer.
 *
 * @return void
 */
function wp_kama_finalized_template_enhancement_output_buffer_action( $output ){

	// action...
}
$output(string)
Finalized output buffer.

Changelog

Since 6.9.0 Introduced.

Where the hook is called

wp_finalize_template_enhancement_output_buffer()
wp_finalized_template_enhancement_output_buffer
wp-includes/template.php 1058
do_action( 'wp_finalized_template_enhancement_output_buffer', $filtered_output );
wp-includes/template.php 962
do_action( 'wp_finalized_template_enhancement_output_buffer', $output );

Where the hook is used in WordPress

Usage not found.