WP_Query::have_comments()publicWP 2.2.0

Determines whether there are more comments available.

Automatically rewinds comments when finished.

Method of the class: WP_Query{}

No Hooks.

Return

true|false. True if comments are available, false if no more comments.

Usage

global $wp_query;
$wp_query->have_comments();

Changelog

Since 2.2.0 Introduced.

WP_Query::have_comments() code WP 6.5.2

public function have_comments() {
	if ( $this->current_comment + 1 < $this->comment_count ) {
		return true;
	} elseif ( $this->current_comment + 1 == $this->comment_count ) {
		$this->rewind_comments();
	}

	return false;
}