函数原型
get_option( string $option, mixed $default = false ): mixed
函数描述
Retrieves an option value based on an option name.
是否弃用
未弃用
函数参数
-
$option
string
Required - Name of the option to retrieve. Expected to not be SQL-escaped.
-
$default
mixed
Optional - Default value to return if the option does not exist.
Default:
false
函数返回值
mixed Value of the option. A value of any type may be returned, including scalar (string, boolean, float, integer), null, array, object.
Scalar and null values will be returned as strings as long as they originate from a database stored option value. If there is no option in the database, boolean false is returned.
函数位置
File: wp-includes/option.php.
函数源码
array(3) {
[0] => bool(false)
[1] => string(3) "str"
[2] => NULL
}源码链接
变更日志
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |

