debug: Add more logging including post_id and postTopHtml preview

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 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-11-27 19:50:53 -06:00
parent 22e9273b4f
commit b9b21c390a

View File

@@ -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());