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.
Pattrick
How can i display only the load Time ?
WPBeginner Support
You would move the echo to after the get_num_queries
Admin
Aidan
You should make clear that the timer_stop() function only measures page load time, not how long the queries take to complete.
These are often related, but the way you present the code makes it look like the queries are always related to the speed issues, and often they aren’t.
Sean Donovan
It would be useful to know what a typical number of queries are for a Wordpress site running 10 or so plugins…
Editorial Staff
Can’t say at all because each plugin varies. You can use 10 plugins that work entirely in the backend which will add no queries on the front-end load. Or 10 really horrible coded plugins that can add tons of queries on the front-end.
Admin
Thoriq
It’s so simple, thanks for sharing this tip.