[wp-trac] [WordPress Trac] #12212: post__in can't manage empty array properly

WordPress Trac wp-trac at lists.automattic.com
Sun Feb 14 03:00:08 UTC 2010


#12212: post__in can't manage empty array properly
--------------------------+-------------------------------------------------
 Reporter:  lifeless85    |       Owner:  ryan          
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  Query         |     Version:  2.9.1         
 Severity:  normal        |    Keywords:  post__in      
--------------------------+-------------------------------------------------

Comment(by dd32):

 I personally believe it's cleaner for the theme to check before it
 mindlessly queries for data, esp. if you've got a list that you're wanting
 to know about.

 > But, this is like saing SELECT ALL ITEMS FROM AN EMPTY GROUP the result
 should be another EMPTY GROUP and now this is not true

 > not exactly the kind of thing i thought i would have found here...

 What i'm trying to explain, Is the way that WordPress uses internal query
 parameters, {{{post__in}}} is designed for a specific purpose, To query
 the posts provided. Thats it, And while i understand your line of thinking
 "But its an empty list!, So i dont want anything returned",

 If we change that particular query param, here's another dozen which would
 have to be changed to make them act the same:
 http://core.trac.wordpress.org/browser/trunk/wp-includes/query.php#L1191
 Consistancy between parameters is crucial if its to be memorised by
 developers, the worst thing is to have to look up "How does this param
 take its arguements"

 I have seen many themes prioritise the sticky posts to the top of the
 pile, and even display them in a seperate block.

 >  Because if you use 'orderby'=>'meta_value' to sort your post, you can't
 have all stiky posts at the top (and sorted too). So ... this is the
 frustrating way, i do this.

 Then it might be worth filing a bug on that specifically, That the sticky
 posts do not abide by the ordering?
 http://core.trac.wordpress.org/browser/trunk/wp-includes/query.php#L2329

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12212#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list