WP_Query::rewind_posts()publicWP 1.5.0

Rewinds the posts and resets post index.

Method of the class: WP_Query{}

No Hooks.

Return

null. Nothing (null).

Usage

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

Changelog

Since 1.5.0 Introduced.

WP_Query::rewind_posts() code WP 6.6.2

public function rewind_posts() {
	$this->current_post = -1;
	if ( $this->post_count > 0 ) {
		$this->post = $this->posts[0];
	}
}