[wp-trac] [WordPress Trac] #39682: WP_Query: Small fix for 'post__in' argument showing all results if empty array is passed

WordPress Trac noreply at wordpress.org
Tue Jan 24 21:28:39 UTC 2017


#39682: WP_Query: Small fix for 'post__in' argument showing all results if empty
array is passed
--------------------------+-----------------------------
 Reporter:  edonramadani  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  4.7
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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
 {{{#!php
 } 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)";
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39682>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list