A WordPress-centric search engine for devs and theme authors



filter_default_option ›

Since4.7.0
Deprecatedn/a
filter_default_option ( $default, $option, $passed_default )
Parameters: (3)
  • (mixed) $default Existing default value to return.
    Required: Yes
  • (string) $option Option name.
    Required: Yes
  • (bool) $passed_default Was `get_option()` passed a default value?
    Required: Yes
Returns:
  • (mixed) Filtered default value.
Defined at:
Codex:

Filter the default value for the option.

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



Source

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'];
}