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:
parent
718cc193c9
commit
d6baca3c35
|
@ -2756,8 +2756,10 @@ class WP_Query {
|
||||||
foreach ( $statuswheres as $index => $statuswhere )
|
foreach ( $statuswheres as $index => $statuswhere )
|
||||||
$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
|
$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
|
||||||
}
|
}
|
||||||
foreach ( $statuswheres as $statuswhere )
|
$where_status = implode( ' OR ', $statuswheres );
|
||||||
$where .= " AND $statuswhere";
|
if ( ! empty( $where_status ) ) {
|
||||||
|
$where .= " AND ($where_status)";
|
||||||
|
}
|
||||||
} elseif ( !$this->is_singular ) {
|
} elseif ( !$this->is_singular ) {
|
||||||
$where .= " AND ($wpdb->posts.post_status = 'publish'";
|
$where .= " AND ($wpdb->posts.post_status = 'publish'";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue