Opened 10 years ago
Closed 8 years ago
#31377 closed enhancement (wontfix)
Add optional blogname to wp_get_sites
Reported by: | elliott-stocks | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.2 |
Component: | Networks and Sites | Keywords: | |
Focuses: | multisite | Cc: |
Description
Currently to get the blogname for a list of sites it requires a call to get_blog_details() per site.
It'd be nice if we could add an optional parameter to wp_get_sites() which includes the blogname. I opted for a SQL query in the patch to prevent heavy use of switch_to_blog().
Attachments (2)
Change History (7)
#1
follow-up:
↓ 2
@
10 years ago
Hi @elliott-stocks, thanks for the report and the patch!
Expanding wp_get_sites()
is definitely a goal. #31148 is working to allow searching by domain/path, which may effectively cover the blogname search for most scenarios.
Searching for data stored in individual options tables rather than in the global wp_site
and wp_sitemeta
tables inspires caution. I'm not sure we would want to go there yet.
#2
in reply to:
↑ 1
@
10 years ago
Replying to jeremyfelt:
Hi @elliott-stocks, thanks for the report and the patch!
Expanding
wp_get_sites()
is definitely a goal. #31148 is working to allow searching by domain/path, which may effectively cover the blogname search for most scenarios.
Searching for data stored in individual options tables rather than in the global
wp_site
andwp_sitemeta
tables inspires caution. I'm not sure we would want to go there yet.
Thanks for the feedback! I figured running the query would be quicker than calling get_blog_option()
per site, as with a huge network that may result in a lot of unnecessary calls to switch_to_blog()
.
I'd be happy to hear your thoughts on improving this.
This ticket was mentioned in Slack in #core by elliott-stocks. View the logs.
10 years ago
This ticket was mentioned in Slack in #core-multisite by jeremyfelt. View the logs.
8 years ago
#5
@
8 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
The best way forward for having blogname
more dynamically accessible is probably via lazy loading meta when accessed for the first time on a WP_Site
object. See #36935. That way we won't have to loop through get_blog_details()
and we only pull the data when we need it.
wp_get_sites()
itself should be deprecated (See #36994) in the near future, so I'm going to close this out as wontfix.
Code formatting fix