WP_Query::next_comment()publicWP 2.2.0

Iterate current comment index and return 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.1.1

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

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