Created
October 31, 2013 17:40
-
-
Save adapicom/7253854 to your computer and use it in GitHub Desktop.
Monitor Wordpress Database Queries
source = http://www.catswhocode.com/blog/speeding-up-your-wordpress-blog-7-effective-solutions
This file contains hidden or 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
add_action( 'wp_footer', 'tcb_note_server_side_page_speed' ); | |
function tcb_note_server_side_page_speed() { | |
date_default_timezone_set( get_option( 'timezone_string' ) ); | |
$content = '[ ' . date( 'Y-m-d H:i:s T' ) . ' ] '; | |
$content .= 'Page created in '; | |
$content .= timer_stop( $display = 0, $precision = 2 ); | |
$content .= ' seconds from '; | |
$content .= get_num_queries(); | |
$content .= ' queries'; | |
if( ! current_user_can( 'administrator' ) ) $content = "<!-- $content -->"; | |
echo $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment