Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am wanting to see the actual SQL that worpress is running to build certain pages, is there a debug method or some other way to outpout this or view it?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use any one of these filters from /wp-includes/query.php


You can print certain parts of the query to the screen to see what's going on under the hood.

For instance, you can add this to your functions file:

add_filter('posts_where_request', 'foo_bar', 1, 10);
function foo_bar($where){
    return $where;
share|improve this answer
I also just found this debug file… it shows all the queries ran, there sql and time to run and methods called –  JasonDavis Oct 5 '11 at 2:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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