From b9b21c390a90834667d89e4b083c995c4c3fb628 Mon Sep 17 00:00:00 2001 From: FrankZamora Date: Thu, 27 Nov 2025 19:50:53 -0600 Subject: [PATCH] debug: Add more logging including post_id and postTopHtml preview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Additional debug info: - Log post_id and URL to identify which post is being processed - Log first 200 chars of postTopHtml to verify content - Log final content length 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Inc/adsense-placement.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Inc/adsense-placement.php b/Inc/adsense-placement.php index f28bf7c2..95b9fa80 100644 --- a/Inc/adsense-placement.php +++ b/Inc/adsense-placement.php @@ -184,7 +184,9 @@ function roi_inject_content_ads(string $content): string global $container; // DEBUG: Log para diagnosticar problema de ads no inyectados - error_log('ROI AdSense Debug: roi_inject_content_ads called'); + $post_id = get_the_ID(); + $post_url = get_permalink(); + error_log('ROI AdSense Debug: roi_inject_content_ads called for post_id=' . $post_id . ', url=' . $post_url); // Solo en posts individuales if (!is_single() || !in_the_loop() || !is_main_query()) { @@ -237,9 +239,11 @@ function roi_inject_content_ads(string $content): string ); $content = $injector->inject($content); - error_log('ROI AdSense Debug: Final injection done. postTop=' . strlen($postTopHtml) . ', postBottom=' . strlen($postBottomHtml)); + $finalContent = $postTopHtml . $content . $postBottomHtml; + error_log('ROI AdSense Debug: Final injection done. postTop=' . strlen($postTopHtml) . ', postBottom=' . strlen($postBottomHtml) . ', finalLength=' . strlen($finalContent)); + error_log('ROI AdSense Debug: First 200 chars of postTopHtml: ' . substr($postTopHtml, 0, 200)); - return $postTopHtml . $content . $postBottomHtml; + return $finalContent; } catch (\Throwable $e) { error_log('ROI AdSense Content ERROR: ' . $e->getMessage() . ' in ' . $e->getFile() . ':' . $e->getLine());