GC_Comment_Query::set_found_comments()

最后更新于:2021-11-26 22:41:49

GC_Comment_Query::set_found_comments()

Populates found_comments and max_num_pages properties for the current query if the limit clause was used.

源文件

文件: gc-includes/class-gc-comment-query.php

	private function set_found_comments() {
		global $gcdb;

		if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) {
			/**
			 * Filters the query used to retrieve found comment count.
			 *
			 * @since 4.4.0
			 *
			 * @param string           $found_comments_query SQL query. Default 'SELECT FOUND_ROWS()'.
			 * @param GC_Comment_Query $comment_query        The `GC_Comment_Query` instance.
			 */
			$found_comments_query = apply_filters( 'found_comments_query', 'SELECT FOUND_ROWS()', $this );

			$this->found_comments = (int) $gcdb->get_var( $found_comments_query );
		}
	}