This global variable prepares everything for posts to be displayed. It gets user information, parses the request, sends headers, gets the posts and registers the globals. It is an instance of class WP which is declared in [wordpress root folder]/wp-includes/classes.php. The global variable is initialized in [wordpress root folder]/wp-settings.php.
This variable need not be directly accessed, [wordpress root folder]/functions.php provides the function wp($query_vars=”) which executes the method main($query_vars=”) to perform all the activities. Methods of this WP class are:
- WP() – the Constructor
Plugin authors don’t have to use this, they can use the global function query_posts($query), defined in [wp root folder]/wp-includes/functions.php, to make a custom query for posts.
Back to full list of global variables.
Technorati tags: wp