From 72798b8a86d560c97d722ce2d0f381c958ba2ace Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 20 Nov 2025 00:53:27 +0700 Subject: [PATCH] debug: Log ALL REST API requests to see actual routes being called Added rest_pre_dispatch filter to log EVERY REST API request. This will show us: - What route is actually being called - If it's /woonoow/v1/products or something else - If WordPress is routing to a different endpoint Expected log: WooNooW REST: GET /woonoow/v1/products If we see different route, that's the problem! --- includes/Api/Routes.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/includes/Api/Routes.php b/includes/Api/Routes.php index c2903db..bdbdd37 100644 --- a/includes/Api/Routes.php +++ b/includes/Api/Routes.php @@ -24,6 +24,14 @@ class Routes { // Initialize controllers (register action hooks) OrdersController::init(); + // Log ALL REST API requests to debug routing + add_filter('rest_pre_dispatch', function($result, $server, $request) { + $route = $request->get_route(); + $method = $request->get_method(); + error_log("WooNooW REST: {$method} {$route}"); + return $result; + }, 10, 3); + add_action('rest_api_init', function () { error_log('WooNooW Routes: rest_api_init hook fired'); $namespace = 'woonoow/v1';