Wp Comment Query Get Total Number Of Comments Fetched

[Solved] Wp Comment Query Get Total Number Of Comments Fetched | Php Frameworks Drupal - Code Explorer | yomemimo.com
Question : WP_Comment_Query get total number of comments fetched

Answered by : uzair-rashid-tak

$query = array( // ... your args here. 'count' => false, // 1. Don't set or set to false 'no_found_rows' => false, // 2. Set to false (default is true) 'number' => 5, // 3. Set to a non-zero value
);
$comment_query = new WP_Comment_Query( $query );
// total for the current results set, e.g. on page 1
$count = count( $comment_query->comments );
// total for all pages, same as when LIMIT is not set
$total = $comment_query->found_comments;

Source : | Last Update : Wed, 20 Apr 22

Answers related to wp comment query get total number of comments fetched

Code Explorer Popular Question For Php Frameworks Drupal