mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
If post__in
or post_parent__in
is passed to WP_Query
as an empty array, nuke the query. Both vars are currently only checked for truthiness after which they are ignored. Setting these vars at all indicates explicit filtering being desired.
Adds unit test. Fixes #28099. Built from https://develop.svn.wordpress.org/trunk@28613 git-svn-id: http://core.svn.wordpress.org/trunk@28437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dfb75f0833
commit
c367eb71e5
@ -2448,6 +2448,9 @@ class WP_Query {
|
||||
} elseif ( $q['post__in'] ) {
|
||||
$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
|
||||
$where .= " AND {$wpdb->posts}.ID IN ($post__in)";
|
||||
} elseif ( isset( $this->query['post__in'] ) ) {
|
||||
$post__in = 0;
|
||||
$where .= " AND 1=0 ";
|
||||
} elseif ( $q['post__not_in'] ) {
|
||||
$post__not_in = implode(',', array_map( 'absint', $q['post__not_in'] ));
|
||||
$where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
|
||||
@ -2458,6 +2461,9 @@ class WP_Query {
|
||||
} elseif ( $q['post_parent__in'] ) {
|
||||
$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
|
||||
$where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
|
||||
} elseif ( isset( $this->query['post_parent__in'] ) ) {
|
||||
$post_parent__in = 0;
|
||||
$where .= " AND 1=0 ";
|
||||
} elseif ( $q['post_parent__not_in'] ) {
|
||||
$post_parent__not_in = implode( ',', array_map( 'absint', $q['post_parent__not_in'] ) );
|
||||
$where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
|
||||
|
Loading…
Reference in New Issue
Block a user