From 4b6459861fd0f3f91bbd5508994449c16a6647f0 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 20 Nov 2025 00:51:00 +0700 Subject: [PATCH] debug: Add permission check logging Added logging to check_admin_permission to see: 1. Does user have manage_woocommerce capability? 2. Does user have manage_options capability? 3. Is permission ALLOWED or DENIED? If permission is DENIED, WordPress won't call our handler. This would explain why route registers SUCCESS but handler not called. --- includes/Api/Permissions.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/includes/Api/Permissions.php b/includes/Api/Permissions.php index 66e8a10..d194d32 100644 --- a/includes/Api/Permissions.php +++ b/includes/Api/Permissions.php @@ -35,6 +35,14 @@ class Permissions { * Used for analytics and admin-only endpoints */ public static function check_admin_permission(): bool { - return current_user_can('manage_woocommerce') || current_user_can('manage_options'); + $has_wc = current_user_can('manage_woocommerce'); + $has_opts = current_user_can('manage_options'); + $result = $has_wc || $has_opts; + error_log(sprintf('WooNooW Permissions: check_admin_permission() - WC:%s Options:%s Result:%s', + $has_wc ? 'YES' : 'NO', + $has_opts ? 'YES' : 'NO', + $result ? 'ALLOWED' : 'DENIED' + )); + return $result; } } \ No newline at end of file