fix(adsense): Disable output buffer causing content loss

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 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-27 20:07:09 -06:00
parent e52df682ae
commit 4119f2e86d

View File

@@ -17,12 +17,20 @@ if (!defined('ABSPATH')) {
/** /**
* Retarda la carga de scripts de AdSense interceptando el buffer de salida * Retarda la carga de scripts de AdSense interceptando el buffer de salida
* *
* NOTA: Este output buffer solo se activa cuando delay_enabled está activo * DESACTIVADO: El renderer (AdsensePlacementRenderer) ya genera scripts con
* en adsense-placement. El renderer ya genera scripts con type="text/plain", * type="text/plain" data-adsense-push, por lo que este output buffer es
* pero este buffer procesa scripts de AdSense que vienen de otras fuentes * REDUNDANTE y causa conflictos con otros buffers (zlib compression).
* (plugins, código manual, etc.) *
* 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() { 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 // Solo ejecutar en frontend
if (is_admin()) { if (is_admin()) {
return; return;