From 4119f2e86d009af9a89347b66bc937fed7baa62e Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Thu, 27 Nov 2025 20:07:09 -0600 Subject: [PATCH] fix(adsense): Disable output buffer causing content loss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output buffer in adsense-delay.php was causing conflicts with zlib compression buffer, resulting in ads being generated but not appearing in final HTML. Root cause: Multiple output buffers (zlib + adsense-delay) were nested improperly, causing ob_end_flush() failures and content loss. Solution: Disable the output buffer since AdsensePlacementRenderer already generates scripts with type="text/plain" data-adsense-push. The buffer was redundant and only needed for external AdSense sources. Debug logs confirmed: - Filter generates ads correctly (598+601 chars) - Content exists after filter (54765 chars) - But ads missing in final HTML (0 roi-ad-slot found) - ob_end_flush() errors in debug.log 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Inc/adsense-delay.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Inc/adsense-delay.php b/Inc/adsense-delay.php index c9188ab7..f3505977 100644 --- a/Inc/adsense-delay.php +++ b/Inc/adsense-delay.php @@ -17,12 +17,20 @@ if (!defined('ABSPATH')) { /** * Retarda la carga de scripts de AdSense interceptando el buffer de salida * - * NOTA: Este output buffer solo se activa cuando delay_enabled está activo - * en adsense-placement. El renderer ya genera scripts con type="text/plain", - * pero este buffer procesa scripts de AdSense que vienen de otras fuentes - * (plugins, código manual, etc.) + * DESACTIVADO: El renderer (AdsensePlacementRenderer) ya genera scripts con + * type="text/plain" data-adsense-push, por lo que este output buffer es + * REDUNDANTE y causa conflictos con otros buffers (zlib compression). + * + * El buffer solo sería necesario para procesar scripts de AdSense de plugins + * externos, pero causa pérdida de contenido al interferir con otros buffers. + * + * @see Public/AdsensePlacement/Infrastructure/Ui/AdsensePlacementRenderer.php */ function roi_delay_adsense_scripts() { + // DESACTIVADO: Output buffer causa conflictos y pérdida de contenido + // El renderer ya genera scripts con type="text/plain" + return; + // Solo ejecutar en frontend if (is_admin()) { return;