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.
This commit is contained in:
dwindown
2025-11-20 00:56:20 +07:00
parent 4974d426ea
commit cf7634e0f4

View File

@@ -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);