WP_Query::reset_postdata()

In this article

After looping through a nested query, this function restores the $post global to the current post in this query.

Source

public function reset_postdata() {
	if ( ! empty( $this->post ) ) {
		$GLOBALS['post'] = $this->post;
		$this->setup_postdata( $this->post );
	}
}

Changelog

VersionDescription
3.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.