filter_default_option

函数


filter_default_option ( $default, $option, $passed_default )
参数
  • (mixed)
    $default
    Existing default value to return.
    Required:
  • (string)
    $option
    Option name.
    Required:
  • (bool)
    $passed_default
    Was `get_option()` passed a default value?
    Required:
返回值
  • (mixed) Filtered default value.
定义位置
  • wp-includes/option.php
    , line 2562
引入
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}`.

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'];
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。