filter_default_option() - WordPress 函数参考中文文档

返回介绍

filter_default_option()

发布于 2017-09-10 字数1603 浏览 787 评论 0

filter_default_option( mixed $default,  string $option,  bool $passed_default )

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 default_option_{$option}.


参数

$default

(mixed)
(Required)
Existing default value to return.

$option

(string)
(Required)
Option name.

$passed_default

(bool)
(Required)
Was get_option() passed a default value?


返回值

(mixed) Filtered default value.


源代码

File: wp-includes/option.php

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

更新日志

Version 描述
4.7.0 Introduced.

相关函数

Uses

  • wp-includes/option.php:
    get_registered_settings()

User Contributed Notes

上一篇:file_is_valid_image()

下一篇:filter_SSL()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!