Codex tools: Log in
Contents |
This function destroys the previous query used on a custom Loop. Function should be called after The Loop to ensure conditional tags work as expected.
<?php wp_reset_query(); ?>
This function does not accept any parameters.
This function does not return any values.
The following example shows how to use wp_reset_query() after a custom loop
<?php query_posts( 'posts_per_page=5' ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?><a href="<?php the_permalink() ?>"><?php the_title() ?></a><br /><?php endwhile; endif; wp_reset_query(); ?>
wp_reset_query() is located in wp-includes/query.php.
Query Tags: WP_Query (Class), get_query_var(), query_posts(), have posts(), the_post(), rewind_posts(), wp_reset_postdata(), wp_reset_query()