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
This commit is contained in:
parent
42a058e986
commit
bf9f2f1cc7
|
@ -1530,7 +1530,7 @@ class WP_Query {
|
||||||
function have_posts() {
|
function have_posts() {
|
||||||
if ($this->current_post + 1 < $this->post_count) {
|
if ($this->current_post + 1 < $this->post_count) {
|
||||||
return true;
|
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_action('loop_end');
|
||||||
// Do some cleaning up after the loop
|
// Do some cleaning up after the loop
|
||||||
$this->rewind_posts();
|
$this->rewind_posts();
|
||||||
|
|
Loading…
Reference in New Issue