summaryrefslogtreecommitdiffstats
path: root/wp-includes/query.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/query.php')
-rw-r--r--wp-includes/query.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/wp-includes/query.php b/wp-includes/query.php
index 2806652..5f5cb3f 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -928,7 +928,7 @@ class WP_Query {
$page_paths = '/' . trim($q['pagename'], '/');
$q['pagename'] = sanitize_title(basename($page_paths));
$q['name'] = $q['pagename'];
- $where .= " AND (ID = '$reqpage')";
+ $where .= " AND ($wpdb->posts.ID = '$reqpage')";
$reqpage_obj = get_page($reqpage);
if ( 'attachment' == $reqpage_obj->post_type ) {
$this->is_attachment = true;
@@ -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();