wp_template_enhancement_output_buffer

FILTER wp-includes\template.php (ligne 1019) github
Filters the template enhancement output buffer prior to sending to the client. This filter only applies the HTML output of an included template. This filter is a progressive enhancement intended for applications such as optimizing markup to improve frontend page load performance. Sites must not depend on this filter applying since they may opt to stream the responses instead. Callbacks for this filter are highly discouraged from using regular expressions to do any kind of replacement on the output. Use the HTML API (either `WP_HTML_Tag_Processor` or `WP_HTML_Processor`), or else use {@see DOM\HtmlDocument} as of PHP 8.4 which fully supports HTML5. Do not print any output during this filter. While filters normally don't print anything, this is especially important since this applies during an output buffer callback. Prior to PHP 8.5, the output will be silently omitted, whereas afterward a deprecation notice will be emitted. Important: Because this filter is applied inside an output buffer callback (i.e. display handler), any callbacks added to the filter 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."

Paramètres

Entrée :
$filtered_output, $output
Sortie :
@param string $filtered_output HTML template enhancement output buffer.
@param string $output          Original HTML template output buffer.

Utilisation

// Modifier la valeur avec le filtre 'wp_template_enhancement_output_buffer'
add_filter('wp_template_enhancement_output_buffer', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($filtered_output) {
    // Modifier la valeur
    return $filtered_output;
}

Actualités

Chargement des actualités...