Changeset 61111 for trunk/src/wp-includes/template.php
- Timestamp:
- 11/01/2025 04:44:21 AM (3 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/template.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/template.php
r61088 r61111 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 or if a plugin has added a {@see 'wp_ send_late_headers'} action. For this default to apply, either of the848 * hooks must be added by the time the template is included at the {@see 'wp_before_include_template'} action. This849 * 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 the851 * template.847 * added or if a plugin has added a {@see 'wp_finalized_template_enhancement_output_buffer'} action. For this 848 * default to apply, either of the hooks must be added by the time the template is included at the 849 * {@see 'wp_before_include_template'} action. This allows template responses to be streamed unless the there is 850 * code which depends on an output buffer being opened. This filter allows a site to opt in to adding such template 851 * enhancement filters later during the rendering of the template. 852 852 * 853 853 * @since 6.9.0 … … 855 855 * @param bool $use_output_buffer Whether an output buffer is started. 856 856 */ 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 return (bool) apply_filters( 'wp_should_output_buffer_template_for_enhancement', has_filter( 'wp_template_enhancement_output_buffer' ) || has_action( 'wp_finalized_template_enhancement_output_buffer' ) ); 858 858 } 859 859 … … 960 960 if ( ! $is_html_content_type ) { 961 961 /** This action is documented in wp-includes/template.php */ 962 do_action( 'wp_ send_late_headers', $output );962 do_action( 'wp_finalized_template_enhancement_output_buffer', $output ); 963 963 return $output; 964 964 } … … 976 976 * fully supports HTML5. 977 977 * 978 * Important: Because this filter is applied inside an output buffer callback (i.e. display handler), any callbacks 979 * added to the filter must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error: 980 * "Cannot use output buffering in output buffering display handlers." 981 * 978 982 * @since 6.9.0 979 983 * … … 984 988 985 989 /** 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 990 * Fires after the template enhancement output buffer has been finalized. 991 * 992 * This happens immediately before the template enhancement output buffer is flushed. No output may be printed at 993 * this action. However, HTTP headers may be sent, which makes this action complimentary to the 994 * {@see 'send_headers'} action, in which headers may be sent before the template has started rendering. In 995 * contrast, this `wp_finalized_template_enhancement_output_buffer` action is the possible point at which HTTP 996 * headers can be sent. This action does not fire if the "template enhancement output buffer" was not started. This 997 * output buffer is automatically started if this action is added before 998 * {@see wp_start_template_enhancement_output_buffer()} runs at the {@see 'wp_before_include_template'} action with 999 * priority 1000. Before this point, the output buffer will also be started automatically if there was a 994 1000 * {@see 'wp_template_enhancement_output_buffer'} filter added, or if the 995 1001 * {@see 'wp_should_output_buffer_template_for_enhancement'} filter is made to return `true`. 996 1002 * 1003 * Important: Because this action fires inside an output buffer callback (i.e. display handler), any callbacks added 1004 * to the action must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal error: 1005 * "Cannot use output buffering in output buffering display handlers." 1006 * 997 1007 * @since 6.9.0 998 1008 * 999 * @param string $output Output buffer.1009 * @param string $output Finalized output buffer. 1000 1010 */ 1001 do_action( 'wp_ send_late_headers', $filtered_output );1011 do_action( 'wp_finalized_template_enhancement_output_buffer', $filtered_output ); 1002 1012 1003 1013 return $filtered_output;
Note: See TracChangeset
for help on using the changeset viewer.