have_posts() – Determines whether current WordPress query has posts to loop over.

You appear to be a bot. Output may be restricted

Description

Determines whether current WordPress query has posts to loop over.

Usage

$bool = have_posts();

Parameters

Returns

bool True if posts are available, false if end of the loop.

Source

File name: wordpress/wp-includes/query.php
Lines:

1 to 9 of 9
function have_posts() {
  global $wp_query;

  if ( ! isset( $wp_query ) ) {
    return false;
  }

  return $wp_query->have_posts();
}
 

 View on GitHub View on Trac