On this page
WP_Query::have_comments(): bool
Whether there are more comments available.
Description
Automatically rewinds comments when finished.
Return
bool True if comments are available, false if no more comments.
Source
File: wp-includes/class-wp-query.php. View all references
public function have_comments() {
if ( $this->current_comment + 1 < $this->comment_count ) {
return true;
} elseif ( $this->current_comment + 1 == $this->comment_count ) {
$this->rewind_comments();
}
return false;
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::rewind_comments() wp-includes/class-wp-query.php | Rewind the comments, resets the comment index and comment to first. |
Used By
| Used By | Description |
|---|---|
| have_comments() wp-includes/query.php | Determines whether current WordPress query has comments to loop over. |
Changelog
| Version | Description |
|---|---|
| 2.2.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/have_comments