1

I am trying to create a WordPress plugin to know page loading time of a WordPress page.I know i can calculate the time using default WordPress function timer_stop(0, 3). But i am looking for an alternative way so that i can find out the loading time even when no hook or PHP function fires due to caching.Is there any way to achieve my goal ? Is there any JavaScript way available ?
Currently using following way :

function loading_time() {


 echo '<p>Page loading time:'.timer_stop(0, 3).' seconds</p>';

}

 add_action( 'shutdown', 'loading_time' );
query
  • 531
  • 3
  • 7
  • 30
  • What do you mean by "calculate page loading" time? Do you need to show remaining time? Just the end time? What is the end use of your plugin? Amswering these questions may help us in offering a solution. – disinfor Jan 06 '20 at 19:15
  • i mean how much time it takes to load the page when someone visits the page.The primary goal is to find out page loading time no matter the page is cached or not. – query Jan 06 '20 at 20:35
  • 1
    Does this answer your question? [Calculating Page Load Time In JavaScript](https://stackoverflow.com/questions/14341156/calculating-page-load-time-in-javascript) – disinfor Jan 06 '20 at 22:03
  • did not work for me. – query Jan 06 '20 at 22:08
  • What didn't work? What did you try? – disinfor Jan 07 '20 at 01:21
  • thanks that works. – query Jan 07 '20 at 22:26

0 Answers0