debug: Add comprehensive logging to trace route registration
Added logging at 3 critical points: 1. rest_api_init hook firing 2. Before ProductsController::register_routes() 3. After ProductsController::register_routes() 4. Inside ProductsController::get_products() This will show us: - Is rest_api_init hook firing? - Is ProductsController being registered? - Is get_products() being called when we hit /products? Expected log sequence: 1. WooNooW Routes: rest_api_init hook fired 2. WooNooW Routes: Registering ProductsController routes 3. WooNooW Routes: ProductsController routes registered 4. WooNooW ProductsController::get_products() CALLED (when API called) If any are missing, we know where the problem is.
This commit is contained in:
@@ -85,6 +85,7 @@ class ProductsController {
|
||||
* Get products list with filters
|
||||
*/
|
||||
public static function get_products(WP_REST_Request $request) {
|
||||
error_log('WooNooW ProductsController::get_products() CALLED');
|
||||
$page = max(1, (int) $request->get_param('page'));
|
||||
$per_page = min(100, max(1, (int) ($request->get_param('per_page') ?: 20)));
|
||||
$search = $request->get_param('search');
|
||||
|
||||
@@ -25,6 +25,7 @@ class Routes {
|
||||
OrdersController::init();
|
||||
|
||||
add_action('rest_api_init', function () {
|
||||
error_log('WooNooW Routes: rest_api_init hook fired');
|
||||
$namespace = 'woonoow/v1';
|
||||
|
||||
// Auth endpoints (public - no permission check)
|
||||
@@ -92,7 +93,9 @@ class Routes {
|
||||
$activity_log_controller->register_routes();
|
||||
|
||||
// Products controller
|
||||
error_log('WooNooW Routes: Registering ProductsController routes');
|
||||
ProductsController::register_routes();
|
||||
error_log('WooNooW Routes: ProductsController routes registered');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user