WP_Query::have_comments()publicWP 2.2.0

Whether there are more comments available.

Automatically rewinds comments when finished.

Метод класса: WP_Query{}

Хуков нет.

Возвращает

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

Использование

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

Список изменений

С версии 2.2.0 Введена.

Код WP_Query::have_comments() WP 6.1.1

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;
}