[wp-hackers] Filtering the default in get_option()
adam at sixohthree.com
Mon Apr 2 23:59:38 UTC 2012
get_option() supports two filters: pre_option_$option and option_$option.
I'd like to filter the options for a plugin, which in this case is stored
as a single serialized array. I was hoping to lock in certain option values
and let the plugin UI handle the rest, but pre_option_$option overrides all
options saved in the database, and option_$option won't run if the option
record does not yet exist in the database. I could probably accomplish this
modifying option filters on the fly (filter on pre_option_, disable filter
and get_option again, modify the value from the database).
As far as patches go, was there ever talk of running the option_$option
filter on the $default value of the function?
More information about the wp-hackers