[wp-hackers] Seeing the Actual SQL statements WP is running when compiling the posts...

Dion Hulse (dd32) wordpress at dd32.id.au
Sat Dec 3 06:07:47 UTC 2011


On 3 December 2011 17:03, IC IC <icwordpress at gmail.com> wrote:
> That's very cool. Thank you..
>
> Along the same learning lines, how about printing the list of every
> single WP function that have run before it makes it to the template?
> And perhaps display that list in the post itself?
>
> Did somebody programmatically do that already?
>
> Obviously, this would be on a test site where it is OK and quite
> interesting to see all the actual run time list..
>
> BTW, is there a way in PHP to tell the functions to output their name
> programmatically?
>
> something like
>
> function xyx ()
> {
>  echo this.function.name;
> }
>

There's a few php "dynamic" constants which refer directly to the
point in execution:
__FUNCTION__, __CLASS__, __FILE__, __LINE__

I don't believe it's possible to get all the functions that have been
executed in PHP, however, you can easily output the name of each
hook(action, filter) as it's fired in WordPress with this code
snippet:

add_action( 'all', function() { var_dump( current_filter() ); });

That'll execute on every WordPress hook, allowing you to see where
each hook is fired.. Can be very useful to work it out.


More information about the wp-hackers mailing list