[wp-trac] [WordPress Trac] #28290: Changing _site_option functions for _network_option functions

WordPress Trac noreply at wordpress.org
Tue Sep 15 14:45:38 UTC 2015


#28290: Changing _site_option functions for _network_option functions
--------------------------------+------------------------
 Reporter:  jmlapam             |       Owner:
     Type:  enhancement         |      Status:  reopened
 Priority:  normal              |   Milestone:  4.4
Component:  Networks and Sites  |     Version:  4.0
 Severity:  normal              |  Resolution:
 Keywords:  needs-patch         |     Focuses:  multisite
--------------------------------+------------------------

Comment (by spacedmonkey):

 Having a look into this, I am starting think that we are looking at this
 all wrong. Here is what I think should be done. Create the following
 functions that leverage the metadata api.

 add_network_meta
 get_network_meta
 set_network_meta
 delete_network_meta

 This would work as standard meta functions, giving the nice standard
 filter and action the metadata api gives.
 Then create wrapper functions, as above.

 get_network_option( $option, $default = false, $network_id = false )
 add_network_option( $option, $value, $network_id = false )
 update_network_option( $option, $value, $network_id = false )
 delete_network_option( $option, $network_id = false )

 These would serve 3 purposes.

 - Add in filters / action found in the *_site_option functions, for
 backwards compatibility
 - Do check to see if is_multisite is true and return options instead
 - Be context aware and know what network you are on, so network is not a
 required field.

 After a version or two, I would deprecated the  *_site_option functions
 and point the internals of those functions to *_network_option.

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


More information about the wp-trac mailing list