get_route(); $method = $request->get_method(); $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); add_action('rest_api_init', function () { error_log('WooNooW Routes: rest_api_init hook fired'); $namespace = 'woonoow/v1'; // Auth endpoints (public - no permission check) register_rest_route( $namespace, '/auth/login', [ 'methods' => 'POST', 'callback' => [ AuthController::class, 'login' ], 'permission_callback' => '__return_true', ] ); register_rest_route( $namespace, '/auth/logout', [ 'methods' => 'POST', 'callback' => [ AuthController::class, 'logout' ], 'permission_callback' => '__return_true', ] ); register_rest_route( $namespace, '/auth/check', [ 'methods' => 'GET', 'callback' => [ AuthController::class, 'check' ], 'permission_callback' => '__return_true', ] ); // Defer to controllers to register their endpoints CheckoutController::register(); OrdersController::register(); AnalyticsController::register_routes(); // Payments controller $payments_controller = new PaymentsController(); $payments_controller->register_routes(); // Store controller $store_controller = new StoreController(); $store_controller->register_routes(); // Shipping controller $shipping_controller = new ShippingController(); $shipping_controller->register_routes(); // Tax controller $tax_controller = new TaxController(); $tax_controller->register_routes(); // Pickup locations controller $pickup_controller = new PickupLocationsController(); $pickup_controller->register_routes(); // Email controller $email_controller = new EmailController(); $email_controller->register_routes(); // Developer controller $developer_controller = new DeveloperController(); $developer_controller->register_routes(); // System controller $system_controller = new SystemController(); $system_controller->register_routes(); // Notifications controller $notifications_controller = new NotificationsController(); $notifications_controller->register_routes(); // Activity Log controller $activity_log_controller = new ActivityLogController(); $activity_log_controller->register_routes(); // Products controller error_log('WooNooW Routes: Registering ProductsController routes'); ProductsController::register_routes(); error_log('WooNooW Routes: ProductsController routes registered'); }); } }