filter_default_option()WP 4.7.0

Filters the default value for the option.

For settings which register a default setting in register_setting(), this function is added as a filter to default_option_{$option}.

No Hooks.


Mixed. Filtered default value.


filter_default_option( $default, $option, $passed_default );
$default(mixed) (required)
Existing default value to return.
$option(string) (required)
Option name.
$passed_default(true|false) (required)
Was get_option() a default value?


Since 4.7.0 Introduced.

Code of filter_default_option() WP 6.0

function filter_default_option( $default, $option, $passed_default ) {
	if ( $passed_default ) {
		return $default;

	$registered = get_registered_settings();
	if ( empty( $registered[ $option ] ) ) {
		return $default;

	return $registered[ $option ]['default'];