#39682 closed enhancement (duplicate)
WP_Query: Small fix for 'post__in' argument showing all results if empty array is passed
Reported by: | edonramadani | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
When an empty array is passed to
$args['posts__in']
it should return no results instead of all posts.
File: wp-includes/class-wp-query.php @line 1956
} elseif ( $q['post__in'] ) {
if(count($q['posts__in']) > 0){
$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
} else {
$post__in = NULL;
}
$where .= " AND {$wpdb->posts}.ID IN ($post__in)";
}
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hey there,
Welcome to WordPress Trac! This was previously reported in #28099 and #12212 and it was decided to not change this behaviour because of backward compatibility concerns.