WordPress at a glance
функция не описана

WP_Query::reset_postdata() public WP 3.7.0

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

It's a method of the class: WP_Query{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$WP_Query = new WP_Query();
$WP_Query->reset_postdata();

Заметки

  • Global. WP_Post. $post Global post object.

Changelog

Since 3.7.0 Introduced.

Код WP_Query::reset_postdata() WP 5.5.1

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