Skip to content

Instantly share code, notes, and snippets.

@kamichimo kamichimo/koabase_disp_sql
Last active Aug 29, 2015

What would you like to do?
define('SAVEQUERIES', 1);
function koabase_disp_sql() {
global $wpdb;
echo '<table class="wp-list-table widefat fixed posts">';
echo '<thead><th>SQL</th><th>Time</th><th>Caller</th></thead>';
echo '<tbody>';
foreach ($wpdb->queries as $q) {
list ($query, $time, $caller) = $q;
echo sprintf("<tr><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$query, $time, str_replace(',', "<br>\n", $caller));
echo '</tbody>';
echo '</table>';
add_action('shutdown', 'koabase_disp_sql');
define ('SAVEQUERIES', true);
global $wpdb;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.