Codex tools: Log in / create account
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('showposts=5'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href=\"<?php the_permalink() ?>\"><?php the_title() ?></a><br />
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Since: 2.3.0
wp_reset_query() is located in wp-includes/query.php.