Archive

Posts Tagged ‘http request’

A http request process in WordPress

June 20th, 2009 No comments

WordPress is my favorite blog system. Some time I will design some wordpress plugin, like Domain Change. Or sometimes I would design some wordpress themes, like grey blue.

All we know, wordpress is written by PHP, and recently I am reading the wordpress source code. I will share my what I could learn from this project in wordpress online. :-)

This post is just part 1, I will write more later.

When a audience visit your wordpress blog, for instance, your wordpress blog address is: http://www.webtoolol.com . It means the audience type this domain in their browsers, for example, Firefox.

Then, your wordpress blog hosting, as a http server, will receive the audience’s request, and will process the information from the request through HTTP protocol.

Once your server finished processing the request, it will send the browser the information which is the audience wanted.

Every URL request will be processed by the index.php in the WP root directory. So, let’s find the index.php in your WP root directory. It’s very simple, just two lines’ codes. Defined the constant var WP_USE_THEMES to true, and require the wp-blog-header.php in the same directory.

So, let’s go to the wp-blog-header.php.

In the wp-blog-header.php, it did the follow things.

  1. define the var $wp_did_header to true
  2. require the wp-load.php
  3. execute the function wp()
  4. require the template-loader.php

So, all things will finish in this file. Here, I recommend a project named wp-roadmap, you can click and go to have a look at  the intro of this project.

bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Powered by Yahoo! Answers