From cf7634e0f480e5ec8dce462dfe56938b5b676a43 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 20 Nov 2025 00:56:20 +0700 Subject: [PATCH] debug: Check if rest_pre_dispatch is bypassing our handler If rest_pre_dispatch returns non-null, WordPress skips the callback entirely. Will log: - NULL (will call handler) = normal, callback will execute - NON-NULL (handler bypassed!) = something is intercepting! This is the ONLY way our callback can be skipped after permission passes. --- includes/Api/Routes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/Api/Routes.php b/includes/Api/Routes.php index bdbdd37..e033b11 100644 --- a/includes/Api/Routes.php +++ b/includes/Api/Routes.php @@ -28,7 +28,11 @@ class Routes { add_filter('rest_pre_dispatch', function($result, $server, $request) { $route = $request->get_route(); $method = $request->get_method(); - error_log("WooNooW REST: {$method} {$route}"); + $result_type = is_null($result) ? 'NULL (will call handler)' : 'NON-NULL (handler bypassed!)'; + error_log("WooNooW REST: {$method} {$route} - Result: {$result_type}"); + if (!is_null($result)) { + error_log("WooNooW REST: BYPASSED! Result type: " . gettype($result)); + } return $result; }, 10, 3);