From b91c8bff619c2008e54a1022c2940edca7942129 Mon Sep 17 00:00:00 2001 From: dwindown Date: Thu, 20 Nov 2025 00:52:20 +0700 Subject: [PATCH] debug: Check if callback is actually callable Testing if [__CLASS__, 'get_products'] is callable. If NO, PHP cannot call the method (maybe method doesn't exist or wrong visibility). If YES but still not called, WordPress routing issue. --- includes/Api/ProductsController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/includes/Api/ProductsController.php b/includes/Api/ProductsController.php index f26730c..74a530d 100644 --- a/includes/Api/ProductsController.php +++ b/includes/Api/ProductsController.php @@ -27,9 +27,13 @@ class ProductsController { error_log('WooNooW ProductsController::register_routes() START'); // List products + $callback = [__CLASS__, 'get_products']; + $is_callable = is_callable($callback); + error_log('WooNooW ProductsController: Callback is_callable: ' . ($is_callable ? 'YES' : 'NO')); + $result = register_rest_route('woonoow/v1', '/products', [ 'methods' => 'GET', - 'callback' => [__CLASS__, 'get_products'], + 'callback' => $callback, 'permission_callback' => [Permissions::class, 'check_admin_permission'], ]); error_log('WooNooW ProductsController: GET /products registered: ' . ($result ? 'SUCCESS' : 'FAILED'));