wp_reset_query()
wp_reset_query() 销毁上一个查询并设置新查询。 Destroys the previous q…
wp_reset_query()
销毁上一个查询并设置新查询。
		Destroys the previous query and sets up a new query.
	
目录锚点:#说明#参数#源码#笔记
说明(Description)
这应该在query_posts()之后和另一个query_posts()之前使用。这将删除以前的WP_Query对象在设置另一个对象之前没有正确销毁时发生的模糊错误。
参数(Parameters)
| 参数 | 类型 | 说明 | 
|---|
源码(Source)
/**
 * Destroy the previous query and set up a new query.
 *
 * This should be used after {@link query_posts()} and before another {@link
 * query_posts()}. This will remove obscure bugs that occur when the previous
 * wp_query object is not destroyed properly before another is set up.
 *
 * @since 2.3.0
 *
 * @global WP_Query $wp_query
 * @global WP_Query $wp_the_query
 */
function wp_reset_query() {
	$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
	wp_reset_postdata();
}| 更新版本 | 源码位置 | 使用 | 被使用 | 
|---|---|---|---|
| 2.3.0 | wp-includes/query.php | 17 | 2 | 
笔记(Notes)
在自定义循环后使用
类别:WordPress 函数手册、 
		本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。




还没有任何评论,赶紧来占个楼吧!