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) )



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.

  • 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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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