WP_Query::next_comment()publicWP 2.2.0

Iterates current comment index and returns WP_Comment object.

Method of the class: WP_Query{}

No Hooks.

Return

WP_Comment. Comment object.

Usage

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

Changelog

Since 2.2.0 Introduced.

WP_Query::next_comment() code WP 6.5.2

public function next_comment() {
	++$this->current_comment;

	/** @var WP_Comment */
	$this->comment = $this->comments[ $this->current_comment ];
	return $this->comment;
}