How do I display database query statistics on Wordpress site?

后端 未结 3 1040
[愿得一人]
[愿得一人] 2021-02-07 10:54

I\'ve noticed that a few Wordpress blogs have query statistics present in their footer that simply state the number of queries and the total time required to process them for th

3条回答
  •  [愿得一人]
    2021-02-07 11:52

    To explain pix0r's code:

    • $wpdb->num_queries is the number of database queries.

    • _e is for localization: http://faq.wordpress.net/view.php?p=50

    • timer_stop() returns the amount of time taken to render the page:
      http://codex.wordpress.org/Function_Reference/timer_stop

提交回复
热议问题