[wp-trac] [WordPress Trac] #35697: Add a `fields` key to `wp_get_sites()`

WordPress Trac noreply at wordpress.org
Tue Feb 2 20:23:14 UTC 2016


#35697: Add a `fields` key to `wp_get_sites()`
--------------------------------+-----------------------------
 Reporter:  flixos90            |      Owner:
     Type:  enhancement         |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 I think it would be useful to have a new `fields` key in the `$args`
 parameter for `wp_get_sites()` to allow returning specific fields only,
 basically to allow developers to create site lists in the way they need
 them more quickly. The idea is based on a similar concept to what we can
 currently do in post or term queries as well.

 Possible use-cases that I have in mind would be:
 * `ids` (returns an array of site IDs)
 * `count` (returns the site count as integer; docs would need to be
 adjusted here since it's no array)
 * `id=>domain` (returns array where key is site ID and value is its
 domain)
 * `id=>path` (similar to `id=>domain`, but with path)
 * `id=>network_id` (similar to `id=>domain`, but with network ID)

 Maybe there's more, but in my opinion that would be a good starting point,
 covering many possible usages.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35697>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list