Published in WordPress
avatar
2 minutes read

How to display all database queries made by Wordpress?

Utilizing a technique like the one portrayed here, I can see the all out number of questions being made in Wordpress when I load a page.

Presently I might want to show all data set questions that are being made when a page loads. This would permit me to see who my greatest asset swines are, without going through the course of end of all my modules and subject contents.

What might be the most effective way to show all data set questions made by Wordpress?

Solutions

In the event that you add define('SAVEQUERIES', consistent with) your arrangement document, you can list every one of the questions made for the ongoing page by adding the accompanying to your subject.

if (current_user_can('administrator')){
    global $wpdb;
    echo "<pre>";
    print_r($wpdb->queries);
    echo "</pre>";
}

See the documentation for additional subtleties: http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis

Comments