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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user