diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 561aa747a756..e46ae817c18d 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -2524,7 +2524,6 @@ public function get_posts() { if ( ! empty( $where_status ) ) { $where .= " AND ($where_status)"; } - } elseif ( ! $this->is_singular ) { if ( 'any' === $post_type ) { $queried_post_types = get_post_types( array( 'exclude_from_search' => false ) ); @@ -2550,7 +2549,7 @@ public function get_posts() { // Public statuses. $public_statuses = get_post_stati( array( 'public' => true ) ); - $status_clauses = []; + $status_clauses = array(); foreach ( (array) $public_statuses as $public_status ) { $status_clauses[] = "{$wpdb->posts}.post_status = '$public_status'"; } @@ -2589,7 +2588,6 @@ public function get_posts() { } else { $where .= ' AND 1=0 '; } - } else { $where .= $post_type_where; }