Ticket #5439: reset_query.2.diff

File reset_query.2.diff, 0.8 kB (added by ryan, 7 months ago)
  • wp-includes/query.php

    old new  
    2525function wp_reset_query() { 
    2626        unset($GLOBALS['wp_query']); 
    2727        $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query']; 
     28        global $wp_query; 
     29        if ( !empty($wp_query->post) ) { 
     30                $GLOBALS['post'] = $wp_query->post; 
     31                setup_postdata($wp_query->post); 
     32        } 
    2833} 
    2934 
    3035/* 
  • wp-includes/widgets.php

    old new  
    874874                        </ul> 
    875875                <?php echo $after_widget; ?> 
    876876<?php 
     877                wp_reset_query();  // Restore global post data stomped by the_post(). 
    877878        endif; 
    878879        wp_cache_add('widget_recent_entries', ob_get_flush()); 
    879880}