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.

I understand WP well enough to create a custom theme at a basic level, but have no experience with the core code. I've also just finished a book on basic php and mysql coding.

I'd like to look 'under the hood' of WP to try and put those together. Can someone tell me:

  • Where to find the files that code for the WP-Mysql connection? (as in, mysqli_connect ...)
  • Where to find the files that code for the get_header() function? (which I assume will have something like include(header.php) )

Thanks!

share|improve this question
1  
Just drop the whole wordpress folder in your favorite code editor and do a global search. And follow @Patj suggestions bellow. –  brasofilo Jul 13 '13 at 16:47
    
How do you code for WordPress? –  brasofilo Jul 13 '13 at 17:05

1 Answer 1

up vote 0 down vote accepted

First off, the usual caveat -- Don't modify core code. (Certainly not on a production site.)

If you read the documentation on the Codex, you'll notice that most if not all of the pages in, say, the Function Reference have a section called Source File. Clicking the link located there will take you to the file in trac where the particular function lives.

For instance, the Codex page for the_ID() points you to wp-includes/post-template.php.

Your specific questions:

Sometimes, though, you'll have to hunt all over the WordPress codebase to follow the track of how does this work? You'll find that functions call other functions, which call other functions, which apply filters, and so forth. There's a lot of digging, sometimes, to understand how something in WordPress actually works. Do it. It's worth it.

share|improve this answer
    
Thank you so much for this extremely helpful and informative response! Just what I was hoping for; I'll start diggin'. . . Is there, in your knowledge, any generalized tutorial of how to begin leaning wp core? It would be very useful for me to have some structure to my learning around this. –  Greg Jul 13 '13 at 16:47
    
Not that I know of, sorry. –  Pat J Jul 13 '13 at 20:33

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.