From bf9f2f1cc7d5569fc11dcddf06585ad3ebda1d92 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Tue, 24 Jun 2008 19:58:54 +0000 Subject: [PATCH] Don't call loop_end hook if we don't have any posts. props Denis-de-Bernardy and DD32. fixes #6769 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@8188 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index c6f662518..8f0961e83 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -1530,7 +1530,7 @@ class WP_Query { function have_posts() { if ($this->current_post + 1 < $this->post_count) { return true; - } elseif ($this->current_post + 1 == $this->post_count) { + } elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) { do_action('loop_end'); // Do some cleaning up after the loop $this->rewind_posts();