70

So like WP must load series of files from,

index.php -> ... -> wp-header.php -> ... ->functions.php

...and so on upon execution.

Also there must be a similar flowchart for functions callings, conditionals and such during the execution. Is such a flowchart(s) available anywhere?

5 Answers 5

114

There is this rather in-depth explanation found at,

Part 1

http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-2315/

Part 2

http://theme.fm/2011/09/wordpress-internals-how-wordpress-boots-up-part-2-2437/

Which also includes some diagrams/flowcharts.

enter image description here

and...

enter image description here

This is also just the start of understanding the WordPress initialization process to which also should include information about the template hierarchy, as well as inspecting which hooks are fired on which pages and when. Combined together you can develop a pretty deep understanding of what's going on and where!


Or this flow chart from Rarst as seen in this question

enter image description here


Run your own backtraces....

enter image description here

How...?

  1. http://www.php.net/manual/en/function.debug-backtrace.php
  2. http://queryposts.com/function/wp_debug_backtrace_summary/

...in their most basic form.

More...

I can not vouch for the above four links specifically, however they are additional material which supports this question that you or others may find useful.


Even more...

Want to see what actions get fired during a request? Take a look at this plugin by Toscho,

enter image description here

Want to see what's hooked and where with what priority? Take a look at this plugin by Rarst,

enter image description here

Very handy for when wanting to know where internal and custom hooks are within the priority chain.

And there's also this plugin by Kaiser,

Only one screenshot of several, rest can be found on GitHub Repo link

enter image description here


There's also this flow chart explaining the query process and what to use when which will help compliment this question,

Original source question and answer here, flow chart by Rarst.

This flowchart and Q&A I can vouch for.

enter image description here

(clicking the image will take you directly to that Q&A thread for more information).


NOTE

Its one thing to look at a flow chart, which is very useful with regards to the visualizing the initialization process and the above links to that topic do some justice but as a WordPress developer, once you're in the thick of things "developing", you want to make use of other debugging tools that help you visualize and understand whats happening during some of these requests. I believe all that's mentioned above go hand in hand.

These are not the ONLY tools that are available, nor the only methods for getting valuable data during initialization/request processes but they are a selection of what I use. Feel free to add more!

TEMPLATE HIERARCHY

You can also interact with this diagram. Clicking the image will take you directly the Theme Handbook by WordPress for more information.

#changelog: 04/10/12 added flow chart from Rarst / "Make sense of WP core load"
1
  • Small hint, lot of this different functions, plugins are functionalities of the Debug Objects plugin. Maybe this helps to understand how WP works.
    – bueltge
    Nov 10, 2017 at 8:14
14

I've always found this template hierarchy pretty handy:

WordPress Template Hierarchy

4

Not exactly the diagrammatic view but I can provide you the description view like this. Try out. This might be helpful for your question.

1
  • Link is broken.
    – Hector
    Dec 16, 2019 at 9:27
4

this article by "Mihai" is really helpful too, especially the chart.

enter image description here

1
  • The link cited is borked. Site not available. Jan 31 at 18:36
-1

I suppose that the service Recognizer help you. It builds a sequence diagram of the Xdebug debugger trace log, which displays the order of calls, arguments, the line where the call came ...

1
  • php-recognizer.ru is no more working
    – mmm
    Oct 7, 2016 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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