Opened 9 years ago
Closed 8 years ago
#35697 closed enhancement (invalid)
Add a `fields` key to `wp_get_sites()`
Reported by: | flixos90 | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Networks and Sites | Keywords: | has-patch needs-docs needs-unit-tests |
Focuses: | multisite | Cc: |
Description
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 toid=>domain
, but with path)id=>network_id
(similar toid=>domain
, but with network ID)
Maybe there's more, but in my opinion that would be a good starting point, covering many possible usages.
Attachments (1)
Change History (11)
#1
@
9 years ago
- Keywords has-patch needs-docs needs-unit-tests added
35697.diff is a take on that enhancement.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
9 years ago
#4
@
9 years ago
- Milestone Awaiting Review deleted
Now that get_sites()
and WP_Site_Query
are available, let's close this out.
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
9 years ago
This ticket was mentioned in Slack in #core-multisite by flixos90. View the logs.
9 years ago
#8
@
9 years ago
- Milestone set to Awaiting Review
- Resolution invalid deleted
- Status changed from closed to reopened
This feature would still be possible in get_sites()
/ WP_Site_Query
, so reopening.
patch with a possible implementation