[wp-trac] [WordPress Trac] #33858: Filter for WordPress option
WordPress Trac
noreply at wordpress.org
Tue Sep 22 22:56:24 UTC 2015
#33858: Filter for WordPress option
-------------------------------------+-------------------------
Reporter: sebastian.pisula | Owner:
Type: enhancement | Status: closed
Priority: normal | Milestone:
Component: Options, Meta APIs | Version: 4.3
Severity: normal | Resolution: worksforme
Keywords: reporter-feedback close | Focuses:
-------------------------------------+-------------------------
Changes (by johnbillion):
* status: new => closed
* resolution: => worksforme
* milestone: Awaiting Review =>
Old description:
> I can add filter to option. Good idea to ACF Page options.
>
> {{{
> add_filter( 'option', 'acf_options_page' );
>
> function acf_options_page( $value, $option,
> $default ) {
> if ( $default == false ) {
> return get_field( $option,
> 'option' );
> }
>
> return $value;
> }
>
> get_option( 'field_from_acf' );
> }}}
New description:
I can add filter to option. Good idea to ACF Page options.
{{{
add_filter( 'option', 'acf_options_page' );
function acf_options_page( $value, $option, $default ) {
if ( $default == false ) {
return get_field( $option, 'option' );
}
return $value;
}
get_option( 'field_from_acf' );
}}}
--
Comment:
As per comments above. The existing filters mean this is already possible.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33858#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list