[wp-trac] [WordPress Trac] #28099: Empty array passed to WP_Query post__in returns posts

WordPress Trac noreply at wordpress.org
Thu May 1 21:24:53 UTC 2014


#28099: Empty array passed to WP_Query post__in returns posts
-----------------------------+----------------------------
 Reporter:  danielbachhuber  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Future Release
Component:  Query            |    Version:
 Severity:  normal           |   Keywords:  needs-patch
  Focuses:                   |
-----------------------------+----------------------------
 When you pass an empty array to `post__in`, you get the most recent posts.

 I'd expect that passing an empty array would produce no results.

 #12212 is a previous conversation on the matter with the
 [https://core.trac.wordpress.org/ticket/12212#comment:26|determination]:

     Strongly tempted to wontfix based on other comments in this thread,
 specifically dd32's comment about A) consistency in arguments, and B) "I
 personally believe it's cleaner for the theme to check before it
 mindlessly queries for data"... Moving to future release for now,
 suggested close.

 However, instantiating a `WP_Query` object and using `if (
 $query->have_posts() )` is a valid, and cleaner, approach in a template.

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


More information about the wp-trac mailing list