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

IC IC icwordpress at gmail.com
Sat Dec 3 06:03:39 UTC 2011


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;
}



On Fri, Dec 2, 2011 at 8:21 PM, Mike Schinkel
<mikeschinkel at newclarity.net> wrote:
> On Dec 2, 2011, at 11:02 PM, IC IC wrote:
>> Is there a way to see/output the actual SQL query wp runs for
>> compiling the current page record(s)?
>>
>> For learning purposes, I'd like to see what SQL query runs when we say
>>
>> query_posts( 'cat=1&tag=apples+apples' );
>>
>> or when I am serving a taxonomy page such as
>>
>> mysite.com/fruits/apple
>>
>> what's the SQL query WP is running? Can I hook into that section and
>> output the SQL statement on the screen?
>
> What dd32 said, or here is a standalone file (maybe name it "test.php"?) which can run in your website's root to display the SQL query you ask for:
>
>
> <?php
>
> include 'wp-load.php';
> $query = new WP_Query('cat=1&tag=apples+apples');
> echo $query->request;
>
>
> -Mike
> _______________________________________________
> 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