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

WordPress Trac noreply at wordpress.org
Thu Apr 4 21:36:59 UTC 2019


#28099: Empty array passed to WP_Query post__in returns posts
-----------------------------+-----------------------------
 Reporter:  danielbachhuber  |       Owner:  wonderboymusic
     Type:  defect (bug)     |      Status:  closed
 Priority:  normal           |   Milestone:
Component:  Query            |     Version:
 Severity:  normal           |  Resolution:  wontfix
 Keywords:  has-patch        |     Focuses:
-----------------------------+-----------------------------

Comment (by leymannx):

 Instead of having that one fixed 5 years ago and then fixed in all
 consecutive places we left that bug behind and now it gets bigger and
 bigger as more and more people rely on it. That's a sad story.

 I'm confirming {{{'post__in' => [0]}}} as a valid workaround. Now
 everybody wanting to dynamically load some extra posts or not needs a
 little switch for that.

     {{{'post__in' => empty( $include ) ? [ 0 ] : $include,}}}

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


More information about the wp-trac mailing list