WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question
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
up vote 1 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


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.