Skip to content

Instantly share code, notes, and snippets.

@jwenerd
Last active August 29, 2015 14:02
Show Gist options
  • Save jwenerd/e682b84774cb26ad046d to your computer and use it in GitHub Desktop.
Save jwenerd/e682b84774cb26ad046d to your computer and use it in GitHub Desktop.
WordPress debug queries and memcached
<?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