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.


Built from https://develop.svn.wordpress.org/trunk@27067


git-svn-id: http://core.svn.wordpress.org/trunk@26940 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-02-02 07:36:13 +00:00
parent 718cc193c9
commit d6baca3c35
1 changed files with 4 additions and 2 deletions

View File

@ -2756,8 +2756,10 @@ class WP_Query {
foreach ( $statuswheres as $index => $statuswhere )
$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
}
foreach ( $statuswheres as $statuswhere )
$where .= " AND $statuswhere";
$where_status = implode( ' OR ', $statuswheres );
if ( ! empty( $where_status ) ) {
$where .= " AND ($where_status)";
}
} elseif ( !$this->is_singular ) {
$where .= " AND ($wpdb->posts.post_status = 'publish'";