Changeset 61088 for trunk/src/wp-includes/template.php
- Timestamp:
- 10/30/2025 12:46:29 AM (6 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/template.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/template.php
r60994 r61088 845 845 * 846 846 * By default, an output buffer is only started if a {@see 'wp_template_enhancement_output_buffer'} filter has been 847 * added. For this default to apply, a filter must be added by the time the template is included at the 848 * {@see 'wp_before_include_template'} action. This allows template responses to be streamed as much as possible 849 * when no template enhancements are registered to apply. This filter allows a site to opt in to adding such 850 * template enhancement filters during the rendering of the template. 847 * added or if a plugin has added a {@see 'wp_send_late_headers'} action. For this default to apply, either of the 848 * hooks must be added by the time the template is included at the {@see 'wp_before_include_template'} action. This 849 * allows template responses to be streamed unless the there is code which depends on an output buffer being opened. 850 * This filter allows a site to opt in to adding such template enhancement filters later during the rendering of the 851 * template. 851 852 * 852 853 * @since 6.9.0 … … 854 855 * @param bool $use_output_buffer Whether an output buffer is started. 855 856 */ 856 return (bool) apply_filters( 'wp_should_output_buffer_template_for_enhancement', has_filter( 'wp_template_enhancement_output_buffer' ) );857 return (bool) apply_filters( 'wp_should_output_buffer_template_for_enhancement', has_filter( 'wp_template_enhancement_output_buffer' ) || has_action( 'wp_send_late_headers' ) ); 857 858 } 858 859 … … 958 959 // If the content type is not HTML, short-circuit since it is not relevant for enhancement. 959 960 if ( ! $is_html_content_type ) { 961 /** This action is documented in wp-includes/template.php */ 962 do_action( 'wp_send_late_headers', $output ); 960 963 return $output; 961 964 } … … 978 981 * @param string $output Original HTML template output buffer. 979 982 */ 980 return (string) apply_filters( 'wp_template_enhancement_output_buffer', $filtered_output, $output ); 981 } 983 $filtered_output = (string) apply_filters( 'wp_template_enhancement_output_buffer', $filtered_output, $output ); 984 985 /** 986 * Fires at the last moment HTTP headers may be sent. 987 * 988 * This happens immediately before the template enhancement output buffer is flushed. This is in contrast with 989 * the {@see 'send_headers'} action which fires after the initial headers have been sent before the template 990 * has begun rendering, and thus does not depend on output buffering. This action does not fire if the "template 991 * enhancement output buffer" was not started. This output buffer is automatically started if this action is added 992 * before {@see wp_start_template_enhancement_output_buffer()} runs at the {@see 'wp_before_include_template'} 993 * action with priority 1000. Before this point, the output buffer will also be started automatically if there was a 994 * {@see 'wp_template_enhancement_output_buffer'} filter added, or if the 995 * {@see 'wp_should_output_buffer_template_for_enhancement'} filter is made to return `true`. 996 * 997 * @since 6.9.0 998 * 999 * @param string $output Output buffer. 1000 */ 1001 do_action( 'wp_send_late_headers', $filtered_output ); 1002 1003 return $filtered_output; 1004 }
Note: See TracChangeset
for help on using the changeset viewer.