Uma área de pesquisa sobre o WordPress para devs e autores do tema



filter_default_option ›

Desde4.7.0
Obsoleton/a
filter_default_option ( $default, $option, $passed_default )
Parâmetros: (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
Retorna:
  • (mixed) Filtered default value.
Definido em:
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}.



Fonte

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