[wp-trac] [WordPress Trac] #44305: The 'fields' query parameter for WP_Query supports only a string

WordPress Trac noreply at wordpress.org
Sun Mar 24 22:54:22 UTC 2019


#44305: The 'fields' query parameter for WP_Query supports only a string
-------------------------------------------------+-------------------------
 Reporter:  ocean90                              |       Owner:
                                                 |  johannadevos
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Query                                |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  good-first-bug has-patch needs-      |     Focuses:  docs
  refresh                                        |
-------------------------------------------------+-------------------------
Changes (by noisysocks):

 * keywords:  good-first-bug has-patch => good-first-bug has-patch needs-
     refresh
 * owner:  (none) => johannadevos
 * status:  new => assigned


Comment:

 Thanks for the patch!

 Reading the updated comment, it's not 100% clear to me that `fields` can
 be set to three and only three options:

 - `'id'` which makes the query return only e.g. post IDs.
 - `'id=>parent'` which makes the query return only e.g. post IDs and their
 parent IDs.
 - Anything else, e.g. `''`, which makes the query return all fields.

 Could we try to have the comment enumerate these options? Here's my
 suggestion:

 {{{
 Which fields to select. Accepts 'ids', which selects just the post ID;
 'id=>parent', which selects just the post ID and the post_parent ID; and
 '', which returns all fields.
 }}}

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


More information about the wp-trac mailing list