Where’s My Query?
Working With WordPress Hooks
How do you know what WordPress is fetching from your database when someone does a site search? Does it include the custom post types created by your specialty theme or plugins? Did you want it to? Larry Aronson provides a quick and dirty hack for displaying the main SQL query statement in the footer of a WordPress page.