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' );