Definition:
function wp_reset_query() {}
Destroy the previous query and set 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.
Source code
function wp_reset_query() {
unset($GLOBALS['wp_query']);
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
wp_reset_postdata();
}
4057

February 12, 2011 


No comments yet... Be the first to leave a reply!