I would like to filter all the options values, but the option filters are option specific. Is there a way I could do something like
add_filter('pre_option_*', 'my_check');
?
I've tried the same thing and was able to hook into the pre_option_
filter by using all
as filter.
add_filter('all', 'pre_option_',1,3);
function pre_option_($actionHook,$bool=false,$option_name)
{
if(strpos($actionHook,'pre_option_') === FALSE){
return $bool;
}
}
I suppose you could use wp_load_alloptions()
and add a filter for each:
foreach ( array_keys( wp_load_alloptions() ) as $option ) {
add_filter( 'pre_option_' . $option, function ( $pre ) use ( $option ) {
// blah
return $pre;
} );
}
get_site_option
it would have been simple but not everyone use it. Of course if this was possible I would trim out wordpress core options for each subsite which are ~100, but wordpress does not provide a general hook when getting the options