[wp-trac] [WordPress Trac] #14777: Adding "fields" to arguments array for get_posts()/query_posts()/WP_Query()

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 4 20:39:00 UTC 2010


#14777: Adding "fields" to arguments array for get_posts()/query_posts()/WP_Query()
--------------------------+-------------------------------------------------
 Reporter:  mikeschinkel  |       Owner:             
     Type:  enhancement   |      Status:  new        
 Priority:  normal        |   Milestone:  3.1        
Component:  Query         |     Version:             
 Severity:  normal        |    Keywords:  needs-patch
--------------------------+-------------------------------------------------

Comment(by mikeschinkel):

 Replying to [comment:8 scribu]:
 > I think we can have both:
 >
 > get_terms() style:
 >
 > {{{'fields' => 'ids'}}}
 >
 > individual fields:
 >
 > {{{'fields' => array('ID', 'post_title')}}}
 >
 > As a follow up, we could add the second style to get_terms() too.

 Cool!

 How would that work with the URL style of querying?  i.e. something like?

 {{{
 fields=ids&post_type=movie&post_status=publish&order=ASC&posts_per_page=-1
 }}}

 And?

 {{{
 fields=(ID,post_title)&post_type=movie&post_status=publish&order=ASC&posts_per_page=-1
 }}}

 Of course the latter would be ugly is urlencoded, but...

 And what would be the options made available?  The only two that come to
 mind are `id+title`, `id+slug` and `*` the latter of which is of course
 the default, but I'm sure there are other use-case needs that don't occur
 to me at the moment.

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


More information about the wp-trac mailing list