debug: Add route registration success/failure logging

Added logging to verify:
1. register_routes() is called
2. register_rest_route() returns success/failure

This will show if route registration is actually working.

If we see FAILED, it means another plugin/route is conflicting.
If we see SUCCESS but get_products() not called, routing issue.
This commit is contained in:
dwindown
2025-11-20 00:49:35 +07:00
parent 55f3f0c2fd
commit cc4db4d98a

View File

@@ -24,12 +24,15 @@ class ProductsController {
* Register REST API routes
*/
public static function register_routes() {
error_log('WooNooW ProductsController::register_routes() START');
// List products
register_rest_route('woonoow/v1', '/products', [
$result = register_rest_route('woonoow/v1', '/products', [
'methods' => 'GET',
'callback' => [__CLASS__, 'get_products'],
'permission_callback' => [Permissions::class, 'check_admin_permission'],
]);
error_log('WooNooW ProductsController: GET /products registered: ' . ($result ? 'SUCCESS' : 'FAILED'));
// Get single product
register_rest_route('woonoow/v1', '/products/(?P<id>\d+)', [