Uno de nuestros usuarios preguntó cómo muestran otros sitios el número de consultas y el tiempo de carga de la página en el pie de página. A menudo verás esto en el pie de página de los sitios y puede decir algo como: “64 consultas en 1,248 segundos”. En este artículo, le mostraremos cómo mostrar el número de consultas y el tiempo de carga de la página en WordPress.
Simplemente pegue el siguiente código donde quiera en los archivos de su tema (como footer.php).
<?php echo get_num_queries(); ?> queries in <?php timer_stop(1); ?> seconds.
Y actualiza la página. Verás el número de consultas y el tiempo de ejecución.
Syed Balkhi
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Pattrick
How can i display only the load Time ?
WPBeginner Support
You would move the echo to after the get_num_queries
Administrador
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.
Administrador
Thoriq
It’s so simple, thanks for sharing this tip.