WP::main()publicWP 2.0.0

Sets up all of the variables required by the WordPress environment.

The action wp has one parameter that references the WP object. It allows for accessing the properties and methods to further manipulate the object.

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

Хуки из метода

Возвращает

null. Ничего.

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

global $wp;
$wp->main( $query_args );
$query_args(строка|массив)
Passed to parse_request().
По умолчанию: ''

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

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

Код WP::main() WP 6.1.1

public function main( $query_args = '' ) {
	$this->init();

	$parsed = $this->parse_request( $query_args );

	if ( $parsed ) {
		$this->query_posts();
		$this->handle_404();
		$this->register_globals();
	}

	$this->send_headers();

	/**
	 * Fires once the WordPress environment has been set up.
	 *
	 * @since 2.1.0
	 *
	 * @param WP $wp Current WordPress environment instance (passed by reference).
	 */
	do_action_ref_array( 'wp', array( &$this ) );
}