is_user_option_local()查看用户选项是否在博客可用

目录

描述

Check whether a usermeta key has to do with a particular blog.

is_user_option_local() 描述

用法

<?php is_user_option_local$key$user_id$blog_id ); ?>

is_user_option_local() 用法

参数

$key

(string) (必填) Usermeta key to check

默认值: None

$user_id

(integer) (可选) User ID whose key to check

默认值: current user

$blog_id

(integer) (可选) Blog ID against which to check

默认值: current user

is_user_option_local() 参数

示例

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */

is_user_option_local() 示例

历史

添加于 版本: MU

is_user_option_local() 历史

源文件

is_user_option_local() 函数的代码位于 wp-includes/ms-functions.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Check whether a usermeta key has to do with the current blog.
 *
 * @since MU
 *
 * @global wpdb $wpdb
 *
 * @param string $key
 * @param int    $user_id Optional. Defaults to current user.
 * @param int    $blog_id Optional. Defaults to current blog.
 * @return bool
 */
function is_user_option_local( $key, $user_id = 0, $blog_id = 0 ) {
	global $wpdb;

	$current_user = wp_get_current_user();
	if ( $blog_id == 0 ) {
		$blog_id = $wpdb->blogid;
	}
	$local_key = $wpdb->get_blog_prefix( $blog_id ) . $key;

	return isset( $current_user->$local_key );
}

is_user_option_local() 源文件

相关