#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: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | 4.7 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.