函数原型
is_user_option_local( string $key, int $user_id, int $blog_id ): bool
函数描述
Check whether a usermeta key has to do with the current blog.
是否弃用
Warning: This function has been deprecated.
函数参数
-
$key
string
Required -
$user_id
int
Optional - Defaults to current user.
-
$blog_id
int
Optional - Defaults to current blog.
函数返回值
bool
函数位置
File: wp-includes/ms-deprecated.php.
函数源码
function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
global $wpdb;
_deprecated_function( __FUNCTION__, '4.9.0' );
$current_user = wp_get_current_user();
if ( $blog_id == 0 ) {
$blog_id = get_current_blog_id();
}
$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;
return isset( $current_user->$local_key );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 4.9.0 | This function has been deprecated. |
| MU (3.0.0) | Introduced. |

