Uses
| Uses | Description |
|---|---|
| wp-includes/class-wp-query.php: WP_Query::have_comments() | Whether there are more comments available. |
Determines whether current WordPress query has comments to loop over.
(bool) True if comments are available, false if no more comments.
This function relies upon the global $wp_query object to be set – this is usually the case from within The Loop.
Warning: this function will always return “false” until after comments_template() has been called. If you need to check for comments before calling comments_template(), use get_comments_number() instead.
File: wp-includes/query.php
function have_comments() {
global $wp_query;
return $wp_query->have_comments();
} | Version | Description |
|---|---|
| 2.2.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/have_comments