From 2acce34d9e670e3eb4e7e304b16368eb38caa820 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Thu, 27 Nov 2025 15:29:16 -0600 Subject: [PATCH] fix(adsense): Disable Auto Ads when disable_auto_ads is enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add enable_page_level_ads: false to prevent Google from automatically inserting ads in unwanted locations - This prevents ads from appearing inside table cells and other inappropriate places 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Inc/adsense-placement.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Inc/adsense-placement.php b/Inc/adsense-placement.php index 2bb4b3c8..640c2d73 100644 --- a/Inc/adsense-placement.php +++ b/Inc/adsense-placement.php @@ -157,6 +157,9 @@ function roi_should_disable_auto_ads(): bool /** * Carga el script principal de AdSense + * + * IMPORTANTE: Si disable_auto_ads está activo, se añade código para + * deshabilitar Auto Ads (page-level ads) de Google. */ function roi_enqueue_adsense_script(): void { @@ -180,13 +183,25 @@ function roi_enqueue_adsense_script(): void } $delayEnabled = ($settings['forms']['delay_enabled'] ?? true) === true; + $disableAutoAds = ($settings['visibility']['disable_auto_ads'] ?? true) === true; + // Script principal de AdSense if ($delayEnabled) { echo '' . "\n"; } else { echo '' . "\n"; } + // Deshabilitar Auto Ads (page-level ads) si está configurado + if ($disableAutoAds) { + echo '' . "\n"; + } + } catch (\Throwable $e) { if (defined('WP_DEBUG') && WP_DEBUG) { error_log('ROI AdSense: ' . $e->getMessage());