Skip to content

Instantly share code, notes, and snippets.

@CaroManel
Created March 7, 2016 04:03
Show Gist options
  • Save CaroManel/8ad96529e7ba47d6a27f to your computer and use it in GitHub Desktop.
Save CaroManel/8ad96529e7ba47d6a27f to your computer and use it in GitHub Desktop.
Show number of Wordpress querys and query strings on footer
function sc_profile() {
//only if we are debugging
if (WP_DEBUG === true) {
//only for administrators
if (current_user_can('level_10')) {
printf("%s queries in %s seconds.", get_num_queries(), timer_stop(0,3));
//show queries
//after adding define('SAVEQUERIES', true ) in the wp-config.php
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
}
}
}
add_action( 'wp_footer', 'sc_profile', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment