fix(php): disable zlib compression conflicting with w3tc
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 <noreply@anthropic.com>
This commit is contained in:
@@ -552,30 +552,22 @@ add_filter( 'wp_lazy_loading_enabled', 'roi_enable_image_dimensions' );
|
|||||||
/**
|
/**
|
||||||
* Optimizar buffer de salida HTML
|
* 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
|
* @since 1.0.0
|
||||||
|
* @deprecated 1.0.1 Conflicto con W3TC page cache - Issue #XX
|
||||||
*/
|
*/
|
||||||
function roi_enable_gzip_compression() {
|
function roi_enable_gzip_compression() {
|
||||||
// Solo en frontend
|
// DESACTIVADO - No hacer nada
|
||||||
if ( is_admin() ) {
|
// La compresión la maneja nginx, no PHP
|
||||||
return;
|
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user