<?php if (is_user_logged_in()){
global $wpdb;
echo "<pre>";
print_r($wpdb->queries);
echo "</pre>";
} ?>剖析:
Array
(
[0] => Array
(
[0] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10
[1] => 0.0003960132598877
[2] => require, wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts
)
[1] => Array
(
[0] => SELECT option_value FROM wp_options WHERE option_name = 'nuodou_header_code' LIMIT 1
[1] => 0.0013589859008789
[2] => require, require_once, include, get_header, locate_template, load_template, require_once, get_option
)
以上就是安达网络工作室关于《输出WordPress数据库查询的具体内容 减少数据库查询次数》的一些看法。更多内容请查看本栏目更多内容!
get_option() 函数应用技巧 get_option()这个函数,实际上咱们在整合后盾性能的时分常常会用到的一个函数,...
WORDPRESS博客站曾经运转快一年了,在伪动态上不断很纠结,空间默许不支持伪动态,网上找了很多办法,用404...
WordPress 3.0 引入导航菜单性能, 让页面的导航和链接的治理变得简略易用. WP 向用户提供了菜单治理页面和多...
在帮King改他的公家情侣博客模版~找了一些找了,总算是把工夫显示为想要的格局了。于是将取得的一些信息记下...
为何要用 get_term_link?: 新类型的分类是无奈用 <?php echo get_category_link( $category_id ); ?> 输入...
WordPress 上获取文章最重要的就是循环(Loop),现实上循环就是去数据库查问到相应的文章,而后临时贮存到...