函数原型
add_blog_option( int $id, string $option, mixed $value ): bool
函数描述
Add a new option for a given blog ID.
是否弃用
未弃用
函数参数
-
$id
int
Required -
A blog ID. Can be null to refer to the current blog.
-
$option
string
Required -
Name of option to add. Expected to not be SQL-escaped.
-
$value
mixed
Optional -
Option value, can be anything. Expected to not be SQL-escaped.
函数返回值
bool True if the option was added, false otherwise.
函数位置
File: wp-includes/ms-blogs.php
.
函数源码
function add_blog_option( $id, $option, $value ) {
$id = (int) $id;
if ( empty( $id ) ) {
$id = get_current_blog_id();
}
if ( get_current_blog_id() == $id ) {
return add_option( $option, $value );
}
switch_to_blog( $id );
$return = add_option( $option, $value );
restore_current_blog();
return $return;
}
源码链接
变更日志
Version | Description |
---|---|
MU (3.0.0) | Introduced. |