WP_Query::rewind_posts() WordPress Method

This method resets the post index to 0, making the first post in the result set the current post. This is useful for looping through posts multiple times.

WP_Query::rewind_posts() #

Rewind the posts and reset post index.


Source

File: wp-includes/class-wp-query.php

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


Top ↑

Changelog

Changelog
VersionDescription
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.