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.
This commit is contained in:
@@ -27,9 +27,13 @@ class ProductsController {
|
|||||||
error_log('WooNooW ProductsController::register_routes() START');
|
error_log('WooNooW ProductsController::register_routes() START');
|
||||||
|
|
||||||
// List products
|
// 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', [
|
$result = register_rest_route('woonoow/v1', '/products', [
|
||||||
'methods' => 'GET',
|
'methods' => 'GET',
|
||||||
'callback' => [__CLASS__, 'get_products'],
|
'callback' => $callback,
|
||||||
'permission_callback' => [Permissions::class, 'check_admin_permission'],
|
'permission_callback' => [Permissions::class, 'check_admin_permission'],
|
||||||
]);
|
]);
|
||||||
error_log('WooNooW ProductsController: GET /products registered: ' . ($result ? 'SUCCESS' : 'FAILED'));
|
error_log('WooNooW ProductsController: GET /products registered: ' . ($result ? 'SUCCESS' : 'FAILED'));
|
||||||
|
|||||||
Reference in New Issue
Block a user