W3cubDocs

/WordPress

have_posts()

Whether current WordPress query has results to loop over.

Description

Return

(bool)

Source

File: wp-includes/query.php

function have_posts() {
	global $wp_query;
	return $wp_query->have_posts();
}

Changelog

Version Description
1.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/have_posts