#41254 closed enhancement (fixed)
Add $default to pre_option_{$option} filter
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Options, Meta APIs | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
Currently the pre_option_{$option} filter passes two options:
/** * Filters the value of an existing option before it is retrieved. * * The dynamic portion of the hook name, `$option`, refers to the option name. * * Passing a truthy value to the filter will short-circuit retrieving * the option value, returning the passed value instead. * * @since 1.5.0 * @since 4.4.0 The `$option` parameter was added. * * @param bool|mixed $pre_option Value to return instead of the option value. * Default false to skip it. * @param string $option Option name. */ $pre = apply_filters( "pre_option_{$option}", false, $option );
What I believe that is needed here is to add $default as well, which could be valuable to the callback hooking in (assuming $default is not false in those use cases).
Attachments (4)
Change History (10)
#2
@
6 years ago
- Keywords has-patch commit added
- Milestone changed from Awaiting Review to 4.9
I'm on board with this. Having access to the value of $default
here would be useful, and actually also in the pre_site_option_{$option}
hook as well.
#3
@
6 years ago
- Owner set to DrewAPicture
- Resolution set to fixed
- Status changed from new to closed
In 41013:
#5
@
6 years ago
Good change but not consistent greeting. We usually start email with "Hi", not "Howdy".
This ticket was mentioned in Slack in #core by jorbin. View the logs.
5 years ago
Note: See
TracTickets for help on using
tickets.
Example use case:
I want to override certain options (from a plugin) for sites on a multisite install to use an option that is instead network-wide.