WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#33814 closed enhancement (duplicate)

Add network param to site option functions

Reported by: spacedmonkey Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.8
Component: Networks and Sites Keywords: has-patch needs-testing needs-unit-tests
Focuses: multisite Cc:

Description

Add a param of network id to get_site_option / add_site_option / update_site_option / delete_site_option functions.

Attachments (1)

33814.patch (14.0 KB) - added by spacedmonkey 3 years ago.

Download all attachments as: .zip

Change History (4)

@spacedmonkey
3 years ago

#1 @jeremyfelt
3 years ago

  • Keywords has-patch needs-testing needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

Excellent!

Related #28290 - I wonder if now could be a time to move to *_network_option() and then convert all *_site_option to wrap. :)

From On API and Naming:

At some point, we should be able to introduce a get_network_option() function to replace get_site_option(), which could follow context switches and accept a network argument. A network ID of “0” could be used in wp_sitemeta (network meta) to store truly global cross-network options.

#2 @spacedmonkey
3 years ago

I wonder if it might be better to just add switch_to_network / restore_current_network functions. With those, users could just switch network, then use get_site_options as normal. The only problem is that those helper functions seem to be blocked in this ticket #29411 .

Also +1 on the name change to *_network_option() . Also willing to submit a patch for that if you want.

#3 @jeremyfelt
3 years ago

  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

It does seem to be time for _network_option. I'm going to reopen #28290, let's concentrate efforts there.

Note: See TracTickets for help on using tickets.