How To Show Number of Queries and Page Load Time in WordPress

79

One of our users asked how do other sites show number of queries and page load time in the footer. You will often see this in the footer of sites and it may say something like: “64 queries in 1.248 seconds”. In this article, we will show you how to show number of queries and page load time in WordPress.

Simply paste the following code anywhere you like in your theme files (such as footer.php).

<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.

And refresh the page. You will see the number of queries and the execution time.