Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
$query_timer = 0;
add_filter( 'do_parse_request', function( $parse ) {
global $query_timer;
$query_timer = microtime( true );
return $parse;
} );
add_action( 'parse_request', function() {
global $query_timer;
$time = microtime( true ) - $query_timer;
add_action( 'wp_head', function() use ( $time ) {
echo '<!-- timer: ' . $time . ' -->';
} );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.