Introduce wp_reset_postdata(). Use it to reset the post global for the current query_posts() call after using a loop with a new WP_Query object. Fixes #12320 props scribu.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -554,7 +554,9 @@ class WP_Widget_Recent_Posts extends WP_Widget {
|
||||
</ul>
|
||||
<?php echo $after_widget; ?>
|
||||
<?php
|
||||
wp_reset_query(); // Restore global post data stomped by the_post().
|
||||
// Reset the global $the_post as this query will have stomped on it
|
||||
wp_reset_postdata();
|
||||
|
||||
endif;
|
||||
|
||||
$cache[$args['widget_id']] = ob_get_flush();
|
||||
|
||||
Reference in New Issue
Block a user