rewind_posts() – what actually the use of it, and where using is required or preferred?

It generally the clears the current loop

// main loop
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>

// rewind
<?php rewind_posts(); ?>

// new loop
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>

Here it clears the main loop and start with the new loop

Reference: http://codex.wordpress.org/Function_Reference/rewind_posts

Leave a Comment