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

IC IC icwordpress at gmail.com
Sat Dec 3 06:41:35 UTC 2011


Is it theoretically possible to write a parser to run over all the
core files and parse each and every function that belongs to the core?

before parser

function get_queried_object_id() {
	global $wp_query;
	return $wp_query->get_queried_object_id();
}


after parser

function get_queried_object_id() {

      $list_of_functions_that_have_run_so_far =
$list_of_functions_that_have_run_so_far .   "get_queried_object_id()";
      or even better
      $list_of_functions_that_have_run_so_far =
$list_of_functions_that_have_run_so_far .   "> wp-includes > query.php
> get_queried_object_id()";


	global $wp_query;
	return $wp_query->get_queried_object_id();
}


would that work? or would there be some functions that would halt the
execution because of this change therefore,  this is a mute exercise?





On Fri, Dec 2, 2011 at 10:07 PM, Dion Hulse (dd32) <wordpress at dd32.id.au> wrote:
> 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.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list