Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

WP_Comment_Query get total number of comments fetched

$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;
 
PREVIOUS NEXT
Tagged: #total #number #comments #fetched
ADD COMMENT
Topic
Name
4+3 =