WP::main() WordPress Method

The WP::main() method is the entry point for Wordpress. It is responsible for initializing the Wordpress environment and loading the necessary files.

WP::main( string|array $query_args = '' ) #

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


Description

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


Top ↑

Parameters

$query_args

(string|array)(Optional)Passed to parse_request().

Default value: ''


Top ↑

Source

File: wp-includes/class-wp.php

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

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

		$this->send_headers();

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

		/**
		 * 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 ) );
	}


Top ↑

Changelog

Changelog
VersionDescription
2.0.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.