WordPress对自定义文章类型的查询结果进行对象缓存

作者: 站长 上传时间: 浏览: N/A 下载: N/A 格式: N/A 评分: N/A

100,
'post_type' => 'tweets',
'post_status' => 'publish' ) ;

$loop = new WP_Query($query);

// transient set to last for 1 hour
set_transient('loop', $loop, 60*60);
}
// do normal loop stuff
if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post();

// show content or whatever you like
the_content();

endwhile;endif;

?>

Leave a Comment