Reset post-related globals in wp_reset_query(). Props Denis-de-Bernardy. fixes #9256

git-svn-id: https://develop.svn.wordpress.org/trunk@11400 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-05-19 16:16:15 +00:00
parent 4a648c3825
commit 506192e771

View File

@ -73,7 +73,8 @@ function &query_posts($query) {
* @uses $wp_query
*/
function wp_reset_query() {
unset($GLOBALS['wp_query']);
foreach ( array('id', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'post', 'wp_query') as $var )
unset($GLOBALS[$var]);
$GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
global $wp_query;
if ( !empty($wp_query->post) ) {