fix(php): toc fallback to raw content when filtered has no headings

When plugins like Thrive Visual Editor transform content for
non-logged users, headings may be removed from the filtered content.
This fix uses raw post_content as fallback when filtered content
has no headings but raw content does.

Also removes temporary debug logging added for diagnosis.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
FrankZamora
2025-12-06 23:08:24 -06:00
parent 83d113d669
commit b509b1a2b4
5 changed files with 16 additions and 76 deletions

View File

@@ -43,15 +43,7 @@ final class PageVisibilityHelper
$container = DIContainer::getInstance();
$useCase = $container->getEvaluateComponentVisibilityUseCase();
$result = $useCase->execute($componentName);
// DEBUG: Log visibility evaluation
if ($componentName === 'table-of-contents') {
$isLoggedIn = is_user_logged_in();
error_log("PageVisibilityHelper DEBUG [{$componentName}] [" . ($isLoggedIn ? "LOGGED" : "GUEST") . "]: result=" . ($result ? "true" : "false"));
}
return $result;
return $useCase->execute($componentName);
}
/**

View File

@@ -15,18 +15,6 @@ final class WordPressPageTypeDetector implements PageTypeDetectorInterface
{
public function detect(): PageType
{
// DEBUG: Log all checks for diagnosis
$isLoggedIn = is_user_logged_in();
$debugData = [
'is_front_page' => is_front_page(),
'is_home' => is_home(),
'is_single' => is_single(),
'is_page' => is_page(),
'is_search' => is_search(),
'is_archive' => is_archive(),
];
error_log("PageTypeDetector DEBUG [" . ($isLoggedIn ? "LOGGED" : "GUEST") . "]: " . json_encode($debugData));
if ($this->isHome()) {
return PageType::home();
}