Fix statistics page error handling

Catch all Twig errors (not just LoaderError) to ensure
fallback to PHP rendering works properly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 00:02:17 +01:00
parent 1008617623
commit f8b88e4c98

View File

@@ -315,8 +315,11 @@ class AnalyticsController
'rest_url' => rest_url('wc-licensed-product/v1/analytics/'), 'rest_url' => rest_url('wc-licensed-product/v1/analytics/'),
]); ]);
return; return;
} catch (\Twig\Error\LoaderError $e) { } catch (\Twig\Error\Error $e) {
// Template not found, use fallback // Any Twig error - fall through to PHP fallback
if (defined('WP_DEBUG') && WP_DEBUG) {
error_log('WC Licensed Product Twig Error: ' . $e->getMessage());
}
} }
} }