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

Showing page load time and number of queries in WordPress is a good practice for observing how much time you page takes to load and how many queries are performed. It is something like “30 queries in 0.637 seconds“. Now I’ll show you how to display page load time and number of queries in WordPress.

 

Open your single.php, page.php, index.php, footer.php or any file and paste the following code:

[code type=”php”]

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

[/code]

After pasting the code, save the file and refresh the page. You’ll get the output like “30 queries in 0.637 seconds“.

Duan Lingxin

Duan Lingxin

Content crafter and chief editor at Scratching Info. Also regular contributor on other major online tech platforms. Security Specialist by day and a writer by night, he does his best to instill his knowledge about tech while delivering inspiring and life changing resources through his writing,

More Posts - Website

Leave a Comment