default_option_(option) filter-hookWP 3.4.0

Filters the default value for an option.

The dynamic portion of the hook name, $option, refers to the option name.

Usage

add_filter( 'default_option_(option)', 'wp_kama_default_option_filter', 10, 3 );

/**
 * Function for `default_option_(option)` filter-hook.
 * 
 * @param mixed  $default_value  The default value to return if the option does not exist in the database.
 * @param string $option         Option name.
 * @param bool   $passed_default Was `get_option()` passed a default value?
 *
 * @return mixed
 */
function wp_kama_default_option_filter( $default_value, $option, $passed_default ){

	// filter...
	return $default_value;
}
$default_value(mixed)
The default value to return if the option does not exist in the database.
$option(string)
Option name.
$passed_default(true|false)
Was get_option() passed a default value?

Changelog

Since 3.4.0 Introduced.
Since 4.4.0 The $option parameter was added.
Since 4.7.0 The $passed_default parameter was added to distinguish between a false value and the default parameter value.

Where the hook is called

get_option()
default_option_(option)
update_option()
default_option_(option)
add_option()
default_option_(option)
wp-includes/option.php 194
return apply_filters( "default_option_{$option}", $default_value, $option, $passed_default );
wp-includes/option.php 208
return apply_filters( "default_option_{$option}", $default_value, $option, $passed_default );
wp-includes/option.php 221
return apply_filters( "default_option_{$option}", $default_value, $option, $passed_default );
wp-includes/option.php 803
if ( apply_filters( "default_option_{$option}", false, $option, false ) === $old_value ) {
wp-includes/option.php 988
if ( apply_filters( "default_option_{$option}", false, $option, false ) !== get_option( $option ) ) {

Where the hook is used in WordPress

wp-includes/class-wp-customize-setting.php 384
add_filter( "default_option_{$id_base}", $multidimensional_filter );
wp-includes/customize/class-wp-customize-nav-menu-setting.php 223
add_filter( 'default_option_nav_menu_options', array( $this, 'filter_nav_menu_options' ) );
wp-includes/default-filters.php 469
add_filter( 'default_option_link_manager_enabled', '__return_true' );
wp-includes/option.php 2768
add_filter( "default_option_{$option_name}", 'filter_default_option', 10, 3 );
wp-includes/option.php 2866
remove_filter( "default_option_{$option_name}", 'filter_default_option', 10 );