[wp-trac] [WordPress Trac] #35698: Distinguish between regular (site) options and network options in `sanitize_option()`
WordPress Trac
noreply at wordpress.org
Tue Feb 2 21:23:42 UTC 2016
#35698: Distinguish between regular (site) options and network options in
`sanitize_option()`
-------------------------+------------------------
Reporter: flixos90 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.5
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: multisite
-------------------------+------------------------
Comment (by flixos90):
Replying to [comment:2 jeremyfelt]:
> Yeah, we'll need to leave the site filter there. If anyone is filtering
that, hopefully they're also being smart about whether the option is site
or network in scope.
In that case maybe we could even add another new filter for site options
that is only run for a regular option. Probably a lot of the filters that
are attached to `sanitize_option_{$option}` are registered automatically
by `register_setting()` - so maybe we could add a
`sanitize_site_option_{$option}` filter, and then in `register_setting()`
apply the callback to that new filter instead of the current one. This
should reduce the probability of conflicts drastically.
It would also mean that the `sanitize_option_{$option}` would solely exist
for the purpose of back compat, since we would replace it with the new
filter in all areas of WordPress Core.
I'm not sure about the naming conventions however, since, although it is
technically a site option, we always call those simply "option", and if
the filter uses "site_option", it might add to the already existing
confusion with blog - site - network. Still, I suppose functionality goes
over weird naming, so I think it would be a good idea to add this other
filter as well.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35698#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list