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.
- define the var $wp_did_header to true
- require the wp-load.php
- execute the function wp()
- require the template-loader.php