Created
March 7, 2016 04:03
-
-
Save CaroManel/8ad96529e7ba47d6a27f to your computer and use it in GitHub Desktop.
Show number of Wordpress querys and query strings on footer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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