Last active
August 29, 2015 14:02
-
-
Save jwenerd/e682b84774cb26ad046d to your computer and use it in GitHub Desktop.
WordPress debug queries and memcached
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
<?php | |
if(defined('WP_DEBUG') && WP_DEBUG ){ | |
add_action('wp_footer','debug_print_queries'); | |
add_action('admin_footer','debug_print_queries'); | |
function debug_print_queries(){ | |
global $wpdb; | |
global $wp_object_cache; | |
if (is_admin()) | |
echo '<pre style="margin-left:10em">'; | |
else | |
echo "<pre>"; | |
echo 'count: ' . count($wpdb->queries); | |
echo "\n"; | |
print_r($wpdb->queries); | |
echo "\n\n"; | |
var_dump($wp_object_cache); | |
echo '</pre>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment