WP_Query::initpublicWP 1.5.0

Initiates object properties and sets default values.

Метод класса: WP_Query{}

Хуков нет.

Возвращает

null. Ничего (null).

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

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

Список изменений

С версии 1.5.0 Введена.

Код WP_Query::init() WP 6.8.1

public function init() {
	unset( $this->posts );
	unset( $this->query );
	$this->query_vars = array();
	unset( $this->queried_object );
	unset( $this->queried_object_id );
	$this->post_count   = 0;
	$this->current_post = -1;
	$this->in_the_loop  = false;
	$this->before_loop  = true;
	unset( $this->request );
	unset( $this->post );
	unset( $this->comments );
	unset( $this->comment );
	$this->comment_count         = 0;
	$this->current_comment       = -1;
	$this->found_posts           = 0;
	$this->max_num_pages         = 0;
	$this->max_num_comment_pages = 0;

	$this->init_query_flags();
}