Display Last Query executed in wordpress | Techbirds

Posted on: February 26, 2014 /

Categories: PHP / Author Name: Shivek Parmar

Some times there is need to display the the query executed in the wordpress. therefore the following 2 lines code would help you to display the Last query executed:

$customPosts = new WP_Query($current_term); echo “Last SQL-Query: {$customPosts->request}”;

$customPosts = new WP_Query($current_term);

echo “Last SQL-Query: {$customPosts->request}”;

In the above code

$current_term

would contain the wordpress query object. Pass your variable of wordpress whose query you want to display.

626 total views, 1 views today

Share this Onfacebook-9926063twitter-1590200linkedin-8311521google-8269900