From 78d2ba57b9cab8048d5f342841c048b9403d5b20 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Fri, 5 Dec 2025 18:55:09 -0600 Subject: [PATCH] fix(php): disable zlib compression conflicting with w3tc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable roi_enable_gzip_compression() function that was enabling zlib.output_compression, preventing W3TC from caching pages. Nginx handles gzip at server level instead. 馃 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Inc/performance.php | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/Inc/performance.php b/Inc/performance.php index cad2d15e..66432a8a 100644 --- a/Inc/performance.php +++ b/Inc/performance.php @@ -552,30 +552,22 @@ add_filter( 'wp_lazy_loading_enabled', 'roi_enable_image_dimensions' ); /** * Optimizar buffer de salida HTML * - * Habilita compresi贸n GZIP si est谩 disponible y no est谩 ya habilitada. + * DESACTIVADO: Esta funci贸n causa conflicto con W3 Total Cache. + * Cuando zlib.output_compression est谩 activo, W3TC no puede cachear + * las p谩ginas porque recibe "Response is compressed". + * + * La compresi贸n GZIP la maneja nginx a nivel de servidor. * * @since 1.0.0 + * @deprecated 1.0.1 Conflicto con W3TC page cache - Issue #XX */ function roi_enable_gzip_compression() { - // Solo en frontend - if ( is_admin() ) { - return; - } - - // Verificar si GZIP ya est谩 habilitado - if ( ! ini_get( 'zlib.output_compression' ) && 'ob_gzhandler' !== ini_get( 'output_handler' ) ) { - // Verificar si la extensi贸n est谩 disponible - if ( function_exists( 'gzencode' ) && extension_loaded( 'zlib' ) ) { - // Verificar headers - if ( ! headers_sent() ) { - // Habilitar compresi贸n - ini_set( 'zlib.output_compression', 'On' ); - ini_set( 'zlib.output_compression_level', '6' ); // Balance entre compresi贸n y CPU - } - } - } + // DESACTIVADO - No hacer nada + // La compresi贸n la maneja nginx, no PHP + return; } -add_action( 'template_redirect', 'roi_enable_gzip_compression', 0 ); +// DESACTIVADO - Conflicto con W3 Total Cache page cache +// add_action( 'template_redirect', 'roi_enable_gzip_compression', 0 ); /** * ============================================================================