Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::get_review_count()
Gets the number of reviews (including review replies) for a given status.
Метод класса: ReviewsListTable{}
Хуков нет.
Возвращает
int
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_review_count( $status, $product_id ) : int;
- $status(строка) (обязательный)
- Status key from ReviewsListTable::get_status_filters().
- $product_id(int) (обязательный)
- ID of the product if we're filtering by product in this request. Otherwise, 0 for no product filters.
Код ReviewsListTable::get_review_count() ReviewsListTable::get review count WC 8.1.1
protected function get_review_count( string $status, int $product_id ) : int { return (int) get_comments( [ 'type__in' => [ 'review', 'comment' ], 'status' => $this->convert_status_to_query_value( $status ), 'post_type' => 'product', 'post_id' => $product_id, 'count' => true, ] ); }