WC_API_Products::register_routes()
Register the routes for this class
GET /products GET /products/count GET /products/<id> GET /products/<id>/reviews
Метод класса: WC_API_Products{}
Хуков нет.
Возвращает
Массив
.
Использование
$WC_API_Products = new WC_API_Products(); $WC_API_Products->register_routes( $routes );
- $routes(массив) (обязательный)
- -
Список изменений
С версии 2.1 | Введена. |
Код WC_API_Products::register_routes() WC API Products::register routes WC 7.5.1
public function register_routes( $routes ) { # GET /products $routes[ $this->base ] = array( array( array( $this, 'get_products' ), WC_API_Server::READABLE ), ); # GET /products/count $routes[ $this->base . '/count' ] = array( array( array( $this, 'get_products_count' ), WC_API_Server::READABLE ), ); # GET /products/<id> $routes[ $this->base . '/(?P<id>\d+)' ] = array( array( array( $this, 'get_product' ), WC_API_Server::READABLE ), ); # GET /products/<id>/reviews $routes[ $this->base . '/(?P<id>\d+)/reviews' ] = array( array( array( $this, 'get_product_reviews' ), WC_API_Server::READABLE ), ); return $routes; }