wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_reset_query › WordPress Function

Since2.3.0
已弃用n/a
wp_reset_query ( 没有参数 )
定义在:
文档:

Destroys the previous query and sets up a new query.

This should be used after query_posts() and before another query_posts(). This will remove obscure bugs that occur when the previous WP_Query object is not destroyed properly before another is set up.


源码

function wp_reset_query() {
	$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
	wp_reset_postdata();
}