rewind_posts()

Rewind the loop posts.


Description Description


Source Source

File: wp-includes/query.php

893
894
895
896
function rewind_posts() {
    global $wp_query;
    $wp_query->rewind_posts();
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.5.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Codex

    Basic Example

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // 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; ?>

You must log in before being able to contribute a note or feedback.