Make WordPress Core


Ignore:
Timestamp:
02/02/2014 07:35:54 AM (11 years ago)
Author:
wonderboymusic
Message:

Fix an error in SQL generation when perm is set and an array is passed for post_status. Adds unit test.

Props oso96_2000.
Fixes #25523.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/query.php

    r27018 r27067  
    27572757                    $statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
    27582758            }
    2759             foreach ( $statuswheres as $statuswhere )
    2760                 $where .= " AND $statuswhere";
     2759            $where_status = implode( ' OR ', $statuswheres );
     2760            if ( ! empty( $where_status ) ) {
     2761                $where .= " AND ($where_status)";
     2762            }
    27612763        } elseif ( !$this->is_singular ) {
    27622764            $where .= " AND ($wpdb->posts.post_status = 'publish'";
Note: See TracChangeset for help on using the changeset viewer.