rewind_posts()
Rewind the loop posts.
Description Description
Source Source
File: wp-includes/query.php
function rewind_posts() {
global $wp_query;
$wp_query->rewind_posts();
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Basic Example
Example with custom query migrated from Codex
<?php $args = array('posts_per_page' = -1); $my_posts = new WP_Query($args); if ($my_posts->have_posts()) : while ($my_posts->have_posts()) : $my_posts->the_post(); ?> <?php the_content(); ?> <?php endwhile; endif; ?> // rewind <?php $my_posts->rewind_posts(); ?> // new loop <?php while ($my_posts->have_posts()) : $my_posts->the_post(); ?> <?php the_content(); ?> <?php endwhile; ?>