WP显示数据库查询次数、时间代码-附美化

将下列代码加入 function.php

 

function __show_sql_query_num(){

if( !current_user_can('manage_options') )
return;

global $wpdb;

echo '<div style="font-size:10px;text-align:center">'.
$wpdb->num_queries.' '.__('SQL queries have been executed to show this page in ').
timer_stop().__('seconds').
'</div>';
}
add_action('wp_footer', '__show_sql_query_num');
 

会在页底添加结果
简要介绍这么多,不懂可以留言询问
评论
©acrdiks | Powered by LOFTER