From 91eeb5ff472fa80abfb7e788e2e341ff5559bd5d Mon Sep 17 00:00:00 2001 From: Mark Jaquith 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: https://develop.svn.wordpress.org/trunk@8188 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 c6f662518a..8f0961e836 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();