Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::get_review_count()
Gets the number of reviews (including review replies) for a given status.
Method of the class: ReviewsListTable{}
No Hooks.
Return
Int
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_review_count( $status, $product_id ) : int;
- $status(string) (required)
- Status key from ReviewsListTable::get_status_filters().
- $product_id(int) (required)
- 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 code WC 8.7.0
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, ] ); }