WP_Query::reset_postdata() – After looping through a nested query, this function restores the $post global to the current post in this query.

You appear to be a bot. Output may be restricted

Description

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

Usage

WP_Query::reset_postdata();

Parameters

Returns

void

Source

File name: wordpress/wp-includes/class-wp-query.php
Lines:

1 to 6 of 6
  public function reset_postdata() {
    if ( ! empty( $this->post ) ) {
      $GLOBALS['post'] = $this->post;
      $this->WP_Query::setup_postdata( $this->post );
    }
  }
 

 View on GitHub View on Trac