[wp-trac] [WordPress Trac] #25344: Introduce *_network_meta() functions
WordPress Trac
noreply at wordpress.org
Wed Apr 5 23:09:31 UTC 2017
#25344: Introduce *_network_meta() functions
--------------------------------+-----------------------------
Reporter: jeremyfelt | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone: Future Release
Component: Networks and Sites | Version: 3.0
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: multisite
--------------------------------+-----------------------------
Comment (by flixos90):
+1
Patch looks good regarding the Meta API. I found only two issues with the
network option implementation:
* In `get_network_option()`, the call should be `get_network_meta(
$network_id, $option )` instead of `get_network_meta( $network_id,
$option, $default )`. The resulting array should then be checked for its
first value. If that exists, we have a match, otherwise the option is not
set and we need to return the default. It would be nice if we could use
`get_network_meta( $network_id, $option, true )`, but that's not possible
since that function returns an empty string if no value is found which
does not allow us to differentiate between "empty value set" vs "no value
found". See @spacedmonkey's patch on #37181. We can also move the
`$default_site_option_{$option}` filter below that to only run it if we
actually need to return the default.
* In `add_network_option()` let's use `add_network_meta( $network_id,
$option, $value, true )` to make sure these values are unique.
I also agree with @spacedmonkey that we'll also need a meta query
implementation for `WP_Network_Query` including `_prime_network_caches()`
in order to bring this into Core. See
https://core.trac.wordpress.org/attachment/ticket/37923/37923.diff, which
includes that functionality for `blogmeta`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/25344#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list