#15054 closed enhancement (worksforme)
Add filter hook to get_option
Reported by: | leogermani | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
Add a filter hook to get_option function to allow plugins to filter options.
Current filter 'pre_option_$option' does not pass the option name as a parameter, so you need to have one specific function for each option you want to filter. This does not allow you to filter dynamically created options, nor lets you filter all options if you want to do so.
Attachments (1)
Change History (7)
#4
@
14 years ago
- Cc gaarai@… added
Since this does have performance implications, can you clarify the value of adding this filter with some examples of when code would need to be able to filter any and all options even when it doesn't know what the options are.
#5
@
14 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
If you need context please use current_filter()
.
#6
@
14 years ago
I wanted it to use in a multi language plugin Im writing.
For instance, I want to filter all options, and, if Im visiting other language than the default, I will return 'myplugin_$language_$option' value instead of $option value.
Using current_filter() is a valid workaround. The only thing is that I have to do a foreach in all existing opions to add a filter for each one.
Anyways, current_filter is fine
cheers
add filter to get_option function