Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_finalized_template_enhancement_output_buffer

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
953           }
954      }
955      if ( null === $is_html_content_type ) {
956           $is_html_content_type = in_array( ini_get( 'default_mimetype' ), $html_content_types, true );
957      }
958
959      // If the content type is not HTML, short-circuit since it is not relevant for enhancement.
960      if ( ! $is_html_content_type ) {
961           /** This action is documented in wp-includes/template.php */
962           do_action( 'wp_finalized_template_enhancement_output_buffer', $output );
963           return $output;
964      }
965
966      $filtered_output = $output;
967
968      $did_just_catch = false;
969
970      $error_log = array();
971      set_error_handler(
 
Line Code
1049            *
1050            * Important: Because this action fires inside an output buffer callback (i.e. display handler), any callbacks
1051            * added to the action must not attempt to start their own output buffers. Otherwise, PHP will raise a fatal
1052            * error: "Cannot use output buffering in output buffering display handlers."
1053            *
1054            * @since 6.9.0
1055            *
1056            * @param string $output Finalized output buffer.
1057            */
1058           do_action( 'wp_finalized_template_enhancement_output_buffer', $filtered_output );
1059      } catch ( Throwable $throwable ) {
1060           // Emit to the error log as a warning not as an error to prevent halting execution.
1061           $did_just_catch = true;
1062           trigger_error(
1063                sprintf(
1064                     /* translators: %s is the class name */
1065                     __( 'Uncaught "%s" thrown:' ),
1066                     get_class( $throwable )
1067                ) . ' ' . $throwable->getMessage(),