Title: WP_Query::rewind_comments
Published: April 25, 2014
Last modified: August 20, 2026

---

# WP_Query::rewind_comments()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#changelog)

Rewinds the comments, resets the comment index and comment to first.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#source)󠁿

    ```php
    public function rewind_comments() {
    	$this->current_comment = -1;
    	if ( $this->comment_count > 0 ) {
    		$this->comment = $this->comments[0];
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/file/wp-includes/class-wp-query.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/class-wp-query.php#L3949)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/class-wp-query.php#L3949-L3954)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#related)󠁿

| Used by | Description | 
| [WP_Query::have_comments()](https://developer.wordpress.org/reference/classes/wp_query/have_comments/)`wp-includes/class-wp-query.php` |

Determines whether there are more comments available.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_query/rewind_comments/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.2.0](https://developer.wordpress.org/reference/since/2.2.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fsummer-heart-0930.chufeiyun1688.workers.dev%3A443%2Fhttps%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_query%2Frewind_comments%2F)
before being able to contribute a note or feedback.