|
|
|
@@ -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 );
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* ============================================================================
|
|
|
|
* ============================================================================
|
|
|
|
|