You've already forked wc-licensed-product
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:
@@ -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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user