option_(option)
Filters the value of an existing option.
The dynamic portion of the hook name, $option, refers to the option name.
Usage
add_filter( 'option_(option)', 'wp_kama_option_filter', 10, 2 );
/**
* Function for `option_(option)` filter-hook.
*
* @param mixed $value Value of the option. If stored serialized, it will be unserialized prior to being returned.
* @param string $option Option name.
*
* @return mixed
*/
function wp_kama_option_filter( $value, $option ){
// filter...
return $value;
}
- $value(mixed)
- Value of the option. If stored serialized, it will be unserialized prior to being returned.
- $option(string)
- Option name.
Changelog
| Since 3.0.0 | Introduced. |
| Since 1.5.0 | As option_{$setting}. |
| Since 4.4.0 | The $option parameter was added. |
Where the hook is called
option_(option)
wp-includes/option.php 256
return apply_filters( "option_{$option}", maybe_unserialize( $value ), $option );
wp-includes/class-wp-customize-widgets.php 2180
$value = apply_filters( 'option_' . $option_name, $value, $option_name );
Where the hook is used in WordPress
wp-includes/class-wp-customize-setting.php 388
add_filter( "option_{$id_base}", $multidimensional_filter );
wp-includes/class-wp-customize-widgets.php 282
add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
wp-includes/customize/class-wp-customize-nav-menu-setting.php 224
add_filter( 'option_nav_menu_options', array( $this, 'filter_nav_menu_options' ) );
wp-includes/default-filters.php 300
add_filter( 'option_ping_sites', 'privacy_ping_filter' );
wp-includes/default-filters.php 301
add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop.
wp-includes/default-filters.php 302
add_filter( 'option_blog_charset', '_canonical_charset' );
wp-includes/default-filters.php 303
add_filter( 'option_home', '_config_wp_home' );
wp-includes/default-filters.php 304
add_filter( 'option_siteurl', '_config_wp_siteurl' );
wp-includes/default-filters.php 314
add_filter( 'option_tag_base', '_wp_filter_taxonomy_base' );
wp-includes/default-filters.php 315
add_filter( 'option_category_base', '_wp_filter_taxonomy_base' );
wp-includes/ms-default-filters.php 120
remove_filter( 'option_siteurl', '_config_wp_siteurl' );
wp-includes/ms-default-filters.php 121
remove_filter( 'option_home', '_config_wp_home' );
wp-includes/ms-default-filters.php 20
add_filter( 'option_users_can_register', 'users_can_register_signup_filter' );