[wp-trac] [WordPress Trac] #19938: Setting fields as ids or id=>parent does not setup post/count properties

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 31 21:02:07 UTC 2012


#19938: Setting fields as ids or id=>parent does not setup post/count properties
--------------------------+-----------------------------
 Reporter:  ejdanderson   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Query         |    Version:  3.0
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 This may be intentional. But consider the following
 {{{
 $query = new WP_Query(array('fields' => 'ids'));
 if ($query->have_posts() || $query->post_count || $query->post ||
 $query->current_post != -1) {
    //do something
 }
 }}}

 The code that sets all these properties is never fired when getting the
 posts, regardless of what is returned.
 The same happens for `array('fields' => 'id=>parent')`;

 Is this intentional? I can see reasons on both sides of this.

 Perhaps at the very least, the 'the_posts' filter needs to be run when
 these arguments are passed

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19938>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list