get_option()
provides couple of filters 'pre_option_'.$option
and 'option_'.$option
.
However most times I tried to make use of these it usually explodes and not worth the trouble - either I need to check another option inside my filter, which triggers my filter, which triggers my filter...
Another common case is that I need to get current option that I am filtering and I cannot do that because I am filtering it.
Just curious - is there some practical logic to follow here? I know I could juggle my filter, but that is overhead that I don't like and filter removal is considered not too reliable by some. ;)
For recent practical example - I want to filter posts_per_rss
to my option, but provide WordPress value if my option is not set (for the record I know that recommended way to mess with it is via post_limits
).
pre_option_.$option
filter is meant to completely override the db-query, so maybe the wp dev thought you will then just add multiple queries instead of the default one. Btw: I hope you don't mind - I slightly modified the Q. :)