query( $args )->get_comments(); if ( ! is_null( $transform ) ) { $comments = array_map( $transform, $comments ); } return $comments; } /** * @param array $args * @param callable|null $transform * * @return Pager */ public function paginate( array $args = [], callable $transform = null ) { $args['no_found_rows'] = false; // Make sure to calc the number of found rows. $query = $this->query( $args ); $pager = new Pager( $query->get_comments(), $query->found_comments, $query->query_vars['number'], $query->query_vars['offset'] ); if ( ! is_null( $transform ) ) { $pager->apply_transform( $transform ); } return $pager; } /** * @param array $args * * @return \WP_Comment_Query */ public function query( array $args = [] ) { return new \WP_Comment_Query( $args ); } }