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!
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user