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

git-svn-id: http://svn.automattic.com/wordpress/trunk@11400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2009-05-19 16:16:15 +00:00
parent eb71bd2f9c
commit 40db336ea7
1 changed files with 2 additions and 1 deletions

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) ) {