Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In WordPress source code, there is one point I can not understand. In /wp-blog-header.php, there is a call to wp() function. However, I can not find any definition for that function. How this call don't cause error?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Just follow the code :).

Before calling wp(), /wp-blog-header.php loads /wp-load.php (which assuming you have correctly installed WordPress) loads /wp-config.php. At the bottom of that file, it calls /wp-settings.php.

This file loads a lot of other files, initialising the core parts of WordPress. Amongst them, is the wp-includes/functions.php file. It's inside this file that wp() is defined.

Once /wp-settings.php has finished loading all the files, wp() is then called - this 'starts' WordPress (interpreting the incoming url, processing it into a query, choosing a template and finally outputting the content and sending into the user.

share|improve this answer

You can see info about the wp() function on queryposts.com which also links to the function on trac. I also learned a surprising amount from Nacin's powerpoint slides from "You Don't Know Query" that discussion the wp() function starting on slide 29.

share|improve this answer
    
@tight slideshow! bookmarked. –  Johannes Pille May 16 '12 at 3:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.