ifacethoughts

wp

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:

  • parse_request($extra_query_vars=”)
  • send_headers()
  • build_query_string()
  • register_globals()
  • init()
  • query_posts()
  • handle_404()
  • main($query_args=”)
  • 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:

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    [...] $wp [...]

  2. Abhijit Nadgouda’s List of WordPress Global Variables « Lorelle on WordPress said:

    [...] Behavior Variables: wp_filter, richedit, page_cache, pagenow, wp_version, table_prefix,wp,admin_page_hooks, wp_object_cache, allowedposttags, allowedtags, and wp_rewrite [...]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.