WordPress.org

Make WordPress Core

Ticket #25523: post-status-perm.25523.diff

File post-status-perm.25523.diff, 706 bytes (added by oso96_2000, 8 years ago)
  • src/wp-includes/query.php

    diff --git src/wp-includes/query.php src/wp-includes/query.php
    index 8bf292e..b5d7e43 100644
    class WP_Query { 
    27552755                                foreach ( $statuswheres as $index => $statuswhere )
    27562756                                        $statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
    27572757                        }
    2758                         foreach ( $statuswheres as $statuswhere )
    2759                                 $where .= " AND $statuswhere";
     2758                        $where_status = implode(' OR ', $statuswheres);
     2759                        if(!empty($where_status))
     2760                                $where .= " AND ($where_status)";
    27602761                } elseif ( !$this->is_singular ) {
    27612762                        $where .= " AND ($wpdb->posts.post_status = 'publish'";
    27622763