[wp-trac] [WordPress Trac] #35379: update_network_option changes stored option value if sanitize_option detects error
WordPress Trac
noreply at wordpress.org
Fri May 6 01:30:12 UTC 2016
#35379: update_network_option changes stored option value if sanitize_option
detects error
-------------------------------------------------+-------------------------
Reporter: thomaswm | Owner: jeremyfelt
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.6
Component: Options, Meta APIs | Version: 3.0
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests needs- | Focuses: multisite
testing |
-------------------------------------------------+-------------------------
Comment (by codex-m):
Replying to [comment:17 jeremyfelt]:
> I gave another read through `sanitize_option()` and still find myself
falling in favor of a new `sanitize_network_option()`. We would still need
to add the old filter, but we could drop all of the site specific option
switching and just focus on the network. This would also eliminate the
need to pass both `$context` and `$context_id`.
>
> Thoughts?
Like @flixos90 I prefer to use only one function instead of using
`sanitize_network_option`. It is because options in WordPress are dual-
purpose and can be used both (single-site or multisite). Options name in
single-site is the same as in the network and validated similarly. Using
one function in this case would be much more user-friendly to me.
By using only one function and passing appropriate values in `$context`
and `@context_id`, we can easily process these options in a network mode
(even though these options are still usable on a single site mode and
validated the same.).
Cheers.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35379#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list